Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6cd8ae

Browse files
committed
Added another tamper script
1 parent 36bc410 commit c6cd8ae

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

tamper/charunicodeencode.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
$Id: charencode.py 2035 2010-10-16 21:33:15Z inquisb $
5+
6+
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
7+
See the file 'doc/COPYING' for copying permission
8+
"""
9+
10+
import string
11+
12+
from lib.core.exception import sqlmapUnsupportedFeatureException
13+
14+
def tamper(place, value):
15+
"""
16+
Replaces value with urlencode of non-encoded chars in value
17+
Example: 'SELECT%20FIELD%20FROM%20TABLE' becomes '%u0053%u0045%u004c%u0045%u0043%u0054%u0020%u0046%u0049%u0045%u004c%u0044%u0020%u0046%u0052%u004f%u004d%u0020%u0054%u0041%u0042%u004c%u0045'
18+
"""
19+
20+
retVal = value
21+
22+
if value:
23+
if place != "URI":
24+
retVal = ""
25+
i = 0
26+
27+
while i < len(value):
28+
if value[i] == '%' and (i < len(value) - 2) and value[i+1] in string.hexdigits and value[i+2] in string.hexdigits:
29+
retVal += value[i:i+3]
30+
i += 3
31+
else:
32+
retVal += '%%u00%X' % ord(value[i])
33+
i += 1
34+
else:
35+
raise sqlmapUnsupportedFeatureException, "can't use tamper script '%s' with 'URI' type injections" % __name__
36+
37+
return retVal

0 commit comments

Comments
 (0)