環境
- phpstudy
- sqli-labs
本地搭建sqli-labs作為演示
抓取數據包——proxy參數
sqlmap提供了--proxy參數來使用戶在進行注入的過程中使用代理
python sqlmap.py -u localhost/sqli-labs/less-2/index.php?id=1 --proxy=127.0.0.1
使用burp即可抓取到sqlmap進行注入時的數據包
使用sqlmap自帶的隨機的(自定義)UA——random-agent、user-agent
在進行注入時,目標網站使用waf,此方法可以繞過根據特征進行防御網站攻擊的waf
python sqlmap.py -u localhost/sqli-labs/less-2/index.php?id=1 --proxy=http://127.0.0.1:8080 --random-agent
可以對比上面UA頭部,UA頭部發生了改變
也可以在注入時使用自定義的UA
python sqlmap.py -u localhost/sqli-labs/less-2/index.php?id=1 --proxy=http://127.0.0.1:8080 --user-agent="Mozilla/5.0 (compatible; Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html)"
延時注入——delay
如果訪問網站過於頻繁,那么可能被目標網站封禁IP,暫時無法訪問網站,sqlmap提供了delay參數來進行延時注入,其中,1是延遲執行sql注入的秒數
python sqlmap.py -u localhost/sqli-labs/less-2/index.php?id=1 --proxy=http://127.0.0.1:8080 --user-agent="Mozilla/5.0 (compatible; Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html)" --delay 1
列出所有的tamper腳本——list-tampers
列出所有sqlmap的tamper腳本以及其對應的描述
python sqlmap.py --list-tampers
清除sqlmap緩存
sqlmap緩存存放的位置為:C:\Users\USERNAME\AppData\Local\sqlmap\output\SITE,其中,USERNAME為用戶的名字,SITE為被掃描的站點的IP或者域名,可以刪除該文件來清除sqlmap在掃描時生成的緩存