File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ """
4+ Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
5+ See the file 'doc/COPYING' for copying permission
6+ """
7+
8+ import string
9+
10+ from lib .core .enums import PRIORITY
11+
12+ __priority__ = PRIORITY .LOWEST
13+
14+ def dependencies ():
15+ pass
16+
17+ def tamper (payload , ** kwargs ):
18+ """
19+ Converts all characters in a given payload (not processing already
20+ encoded)
21+
22+ Reference: https://www.acunetix.com/vulnerabilities/unicode-transformation-issues/
23+
24+ >>> tamper('SELECT FIELD FROM TABLE WHERE 2>1')
25+ 'SELECT%C0%AAFIELD%C0%AAFROM%C0%AATABLE%C0%AAWHERE%C0%AA2%C0%BE1'
26+ """
27+
28+ retVal = payload
29+
30+ if payload :
31+ retVal = ""
32+ i = 0
33+
34+ while i < len (payload ):
35+ if payload [i ] == '%' and (i < len (payload ) - 2 ) and payload [i + 1 :i + 2 ] in string .hexdigits and payload [i + 2 :i + 3 ] in string .hexdigits :
36+ retVal += payload [i :i + 3 ]
37+ i += 3
38+ else :
39+ if payload [i ] not in (string .ascii_letters + string .digits ):
40+ retVal += "%%C0%%%.2X" % (0x8A | ord (payload [i ]))
41+ else :
42+ retVal += payload [i ]
43+ i += 1
44+
45+ return retVal
You can’t perform that action at this time.
0 commit comments