Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #!/usr/bin/python
  2. import requests
  3. import json
  4. user = "omar-dmsn@hotmail.es"
  5. password = "k1k1k1k1"
  6. checkip = "http://thisisnt.com/api/getRemoteIp.php"
  7. dynupdate = "https://members.dyndns.com/nic/update"
  8. print "starting. Get current IP..."
  9. ipraw = requests.get(checkip)
  10. if ipraw.status_code is not 200:
  11. raise "Cannot get IP address"
  12. exit
  13.  
  14. ip = ipraw.json()['REMOTE_ADDR']
  15. print "Remote IP: " + ip
  16. print "updating..."
  17. # update dyndns
  18. headers = {'user-agent': 'mPythonClient/0.0.3'}
  19. dyn = requests.get(dynupdate,
  20. headers=headers,
  21. auth=(user, password),
  22. params={'hostname': 'xjhdshsdhagsafhg.ddns.net',
  23. 'myip': ip,
  24. 'wildcard': 'NOCHG',
  25. 'mx': 'MX',
  26. })
  27. if dyn.status_code is not 200:
  28. print "Update failed. HTTP Code: " + str(dyn.status_code)
  29. if "good" in dyn.text:
  30. print "update successful.."
  31. else:
  32. print "Update unsuccessful: " + dyn.text.strip()
  33.  
  34. print "Update unsuccessful: " + dyn.text.strip()
  35.  
  36. print "update successful.."+ip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement