You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#!/usr/bin/env python
"""
Copyright (c) 2006-2024 sqlmap developers (https://sqlmap.org/)
See the file ' LICENSE ' for copying permission
"""
import re
from lib . core . enums import PRIORITY
__priority__ = PRIORITY . HIGHEST # 设置优先级为最高
def dependencies ( ) :
pass
def tamper ( payload , * * kwargs ) :
"""
这个函数用于篡改( tamper) 输入的payload, 以绕过某些安全防护措施。
参数:
payload: 要篡改的原始payload。
**kwargs: 其他可选参数( 在本函数中未使用) 。
功能:
将payload中的<int> UNION替换为<int>e0UNION, 以尝试绕过安全防护。
要求:
* 适用于MySQL和MsSQL数据库。
注意:
* 参考文档: https://media.blackhat.com/us-13/US-13-Salgado-SQLi-Optimization-and-Obfuscation-Techniques-Slides.pdf
* 该函数假设输入的payload是有效的, 并且不进行任何错误处理。
示例:
>>> tamper( ' 1 UNION ALL SELECT ' )
' 1e0UNION ALL SELECT '
"""
# 使用正则表达式替换payload中的数字和UNION之间的空格为'e0'
# \g<1>表示匹配的第一个括号中的内容,\g<2>表示第二个括号中的内容
return re . sub ( r " (?i)( \ d+) \ s+(UNION ) " , r " \ g<1>e0 \ g<2> " , payload ) if payload else payload