Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/tamper/hexentities.py
2983 views
1
#!/usr/bin/env python
2
3
"""
4
Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org)
5
See the file 'LICENSE' for copying permission
6
"""
7
8
from lib.core.enums import PRIORITY
9
10
__priority__ = PRIORITY.LOW
11
12
def dependencies():
13
pass
14
15
def tamper(payload, **kwargs):
16
"""
17
HTML encode in hexadecimal (using code points) all characters (e.g. ' -> 1)
18
19
>>> tamper("1' AND SLEEP(5)#")
20
'1' AND SLEEP(5)#'
21
"""
22
23
retVal = payload
24
25
if payload:
26
retVal = ""
27
i = 0
28
29
while i < len(payload):
30
retVal += "&#x%s;" % format(ord(payload[i]), "x")
31
i += 1
32
33
return retVal
34
35