Created
December 13, 2012 16:03
-
-
Save attakei/4277440 to your computer and use it in GitHub Desktop.
value-domain.com向けのDDNSクライアント(やっつけ感満載) サインインし忘れて張ってしまった、https://gist.github.com/4277425 の貼り直し
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib | |
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 + '?' + urllib.urlencode(param) | |
print 'REQUEST: ' + uri | |
print urllib2.urlopen(uri).read() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment