2 import urllib2, socket, urllib, sys
4 # configuration variables
6 domains = ['your.domain.ralfj.de'] # list of domains to update
7 password = 'yourpassword'
8 # END of configuration variables
10 def update_domain(domain):
11 '''Update the given domain, using the global server, user, password. Returns True on success, False on failure.'''
12 # check if the domain is already mapped to our current IP
13 myip = urllib2.urlopen('https://'+server+'/checkip').read().strip()
14 domainip = socket.gethostbyname(domain)
19 # we need to update the IP
20 result = urllib2.urlopen('https://'+server+'/update?password='+urllib.quote(password)+'&domain='+urllib.quote(domain)+'&ip='+urllib.quote(myip)).read().strip()
21 if 'good '+myip == result:
25 # Something went wrong
26 print "Unexpected answer from server",server,"while updating",domain,"to",myip
31 for domain in domains:
32 if not update_domain(domain):