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
"""
from lib . core . enums import PRIORITY # 从核心库导入优先级枚举
# 设置优先级为低
__priority__ = PRIORITY . LOW
def dependencies ( ) :
pass
def tamper ( payload , * * kwargs ) :
"""
这个函数用于篡改( tamper) 输入的payload, 将所有字符转换为HTML实体( 使用十进制代码点) 。
参数:
payload: 要篡改的原始payload。
**kwargs: 其他可选参数( 在本函数中未使用) 。
功能:
- 遍历payload中的每个字符, 并将每个字符转换为其对应的HTML实体形式( 例如, ' -> ')。
示例:
>>> tamper( " 1 ' AND SLEEP(5)# " )
' 1' AND SLEEP(5)# '
"""
retVal = payload # 初始化返回值为输入的payload
if payload : # 如果payload不为空
retVal = " " # 初始化返回值字符串
i = 0 # 初始化索引
# 遍历payload中的每个字符
while i < len ( payload ) :
# 将当前字符转换为其对应的HTML实体形式, 并添加到返回值字符串
retVal + = " &# %s ; " % ord ( payload [ i ] )
i + = 1
return retVal