Skip to content

Instantly share code, notes, and snippets.

Created December 13, 2012 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4277425 to your computer and use it in GitHub Desktop.
Save anonymous/4277425 to your computer and use it in GitHub Desktop.
value-domain.com 向けのやっつけ感満載なDDNSクライアント。
import urllib2
import re
DDNS_HTTP_URL = 'http://dyn.value-domain.com/cgi-bin/dyn.fcg'
TARGET_BASE_PARAM = {
'd':'example.com',
'p':'password',
'h':'subdomain',
'i':'ip-address'
}
def main():
ip_search = re.search('<input type=text name=i value=(?P<ipaddr>[0-9.]+)>', \
urllib2.urlopen(DDNS_HTTP_URL).read()).group('ipaddr')
param = dict(TARGET_BASE_PARAM, i=ip_search)
uri = DDNS_HTTP_URL + '?'
for k,v in param.items():
uri += k + '=' + v + '&'
print 'REQUEST: ' + uri[:-1]
print urllib2.urlopen(uri[:-1]).read()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment