2 # dynamic dns updater for everydns.net
3 # takes domain to update as an argument
13 url
= 'http://ip.cutup.org'
14 return urllib
.urlopen(url
).read()
17 host
= 'dyn.everydns.net'
18 page
= 'index.php?ver=0.1&domain='
20 (user
, acct
, passwd
) = netrc
.netrc().authenticators(host
)
22 return "auth not found in netrc"
23 url
= 'http://%s:%s@%s/%s%s' % (user
, passwd
, host
, page
, domain
)
25 response
= urllib
.urlopen(url
).read()
27 response
= "error updating IP"
31 if len(sys
.argv
) != 1:
38 if os
.path
.exists(tmpfile
):
39 f
= open(tmpfile
, 'r')
40 oldip
= f
.readline().rstrip(os
.linesep
)
44 response
= everydns(sys
.argv
[1])
45 f
= open(tmpfile
, 'w')
46 f
.write(currip
+ '\n')
47 f
.writelines(response
)
50 if "__main__" == __name__
: