mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
more standard way to display hex encoded char (\xff instead of \ff) also compatible with python representation
This commit is contained in:
parent
05a0e1d3b0
commit
4d8a49a87c
|
@ -153,7 +153,7 @@ def safecharencode(value):
|
|||
for char in SAFE_ENCODE_SLASH_REPLACEMENTS:
|
||||
retVal = retVal.replace(char, repr(char).strip('\''))
|
||||
|
||||
retVal = reduce(lambda x, y: x + (y if (y in string.printable or ord(y) > 255) else '\%02x' % ord(y)), retVal, unicode())
|
||||
retVal = reduce(lambda x, y: x + (y if (y in string.printable or ord(y) > 255) else '\\x%02x' % ord(y)), retVal, unicode())
|
||||
|
||||
elif isinstance(value, list):
|
||||
for i in xrange(len(value)):
|
||||
|
@ -173,7 +173,7 @@ def safechardecode(value):
|
|||
while True:
|
||||
match = regex.search(retVal)
|
||||
if match:
|
||||
retVal = retVal.replace(match.group("result"), binascii.unhexlify(match.group("result").lstrip('\\')))
|
||||
retVal = retVal.replace(match.group("result"), binascii.unhexlify(match.group("result").lstrip('\\x')))
|
||||
else:
|
||||
break
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ MAX_INT = sys.maxint
|
|||
IGNORE_PARAMETERS = ("__VIEWSTATE", "__EVENTARGUMENT", "__EVENTTARGET", "__EVENTVALIDATION", "ASPSESSIONID", "ASP.NET_SESSIONID", "JSESSIONID", "CFID", "CFTOKEN")
|
||||
|
||||
# Regex used for recognition of hex encoded characters
|
||||
HEX_ENCODED_CHAR_REGEX = r"(?P<result>\\[0-9A-Fa-f]{2})"
|
||||
HEX_ENCODED_CHAR_REGEX = r"(?P<result>\\x[0-9A-Fa-f]{2})"
|
||||
|
||||
# Raw chars that will be safe encoded to their slash (\) representations (e.g. newline to \n)
|
||||
SAFE_ENCODE_SLASH_REPLACEMENTS = "\\\t\n\r\x0b\x0c"
|
||||
|
|
Loading…
Reference in New Issue
Block a user