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.
sqlmap/src/sqlmap-master/tamper/decentities.py

45 lines
1.3 KiB

This file contains ambiguous Unicode characters!

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