Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import requests
- import json
- user = "omar-dmsn@hotmail.es"
- password = "k1k1k1k1"
- checkip = "http://thisisnt.com/api/getRemoteIp.php"
- dynupdate = "https://members.dyndns.com/nic/update"
- print "starting. Get current IP..."
- ipraw = requests.get(checkip)
- if ipraw.status_code is not 200:
- raise "Cannot get IP address"
- exit
- ip = ipraw.json()['REMOTE_ADDR']
- print "Remote IP: " + ip
- print "updating..."
- # update dyndns
- headers = {'user-agent': 'mPythonClient/0.0.3'}
- dyn = requests.get(dynupdate,
- headers=headers,
- auth=(user, password),
- params={'hostname': 'xjhdshsdhagsafhg.ddns.net',
- 'myip': ip,
- 'wildcard': 'NOCHG',
- 'mx': 'MX',
- })
- if dyn.status_code is not 200:
- print "Update failed. HTTP Code: " + str(dyn.status_code)
- if "good" in dyn.text:
- print "update successful.."
- else:
- print "Update unsuccessful: " + dyn.text.strip()
- print "Update unsuccessful: " + dyn.text.strip()
- print "update successful.."+ip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement