一、 常用的sql函数有哪些? select database() #查看当前数据库名 select version() #查看当前数据库版本 select user() #查看当前数据库的用户 group_concat(字段名) #主要用来处理一对多的查询结果主要用来处理一对多的查询结果 limit 1,1 #在查询多结果的显示数量,第一个1为开始位,为0起步,第二个1为数量 #报错注入函数 extractvalue(1,2) updatexml(1,2,3) 0x7e 为~的十六进制 注:这里如说使用updatexml来查询表中数据时,会出现查询数据不完整的问题, 解决方案: 这里我们可以使用limit来限制查询个数,来一个一个查询,也可以使用group_concat时使用substr进行字符串截取 其中"1,32"控制截取的起始与结束位置: length() #查询内容长度 ascii() #将字符转换为ascii码 substr(内容,1,1) #第一个1 为开始位置,这里是从1 开始,第二个1,为长度 sleep() #延迟函数 if(1,2,3) #1为条件,2为成功后执行的语句,3为失败后的语句 load_file() #访问文件函数 二、 information_schema数据库里面重点应该关注哪些数据表? mysql注入前提知识 information_schema 该数据库中存放了所有数据库和数据表的内容,我们可以调用该数据库,来查询数据表的内容 information_schema的schema表 存放有数据库的名 schema_name 字段为数据库名 information_schema中的tables 表 存放了所有数据库的表名 table_schema 字段为数据库名 table_name 字段为数据表名 information_schema中的columns 表 三、 通过information_schema查询库名、表名、以及自己创建的数据表的字段名和具体数据 select schema_name frominformation_schema.schemata #查库 select table_name frominformation_schema.tables where table_schema="xuesheng" #查表 select column_name frominformation_schema.columns where table_schema="xuesheng" andtable_name='xuesheng_user' #查字段 select * from xuesheng.xuesheng_user #查数据
|