mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
Improvement of decodeIntToUnicode()
This commit is contained in:
parent
1153b4563c
commit
b820975217
|
@ -2523,16 +2523,23 @@ def openFile(filename, mode='r'):
|
|||
|
||||
def decodeIntToUnicode(value):
|
||||
"""
|
||||
Decodes inferenced integer value with usage of current page encoding
|
||||
Decodes inferenced integer value to an unicode character
|
||||
"""
|
||||
try:
|
||||
# http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_ord
|
||||
if Backend.getIdentifiedDbms() in (DBMS.MYSQL,) or conf.charset:
|
||||
return struct.pack('B' if value < 256 else '<H', value).decode(kb.pageEncoding or UNICODE_ENCODING)
|
||||
else:
|
||||
return unichr(value)
|
||||
except:
|
||||
return INFERENCE_UNKNOWN_CHAR
|
||||
retVal = value
|
||||
|
||||
if isinstance(value, int):
|
||||
try:
|
||||
# http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_ord
|
||||
if Backend.getIdentifiedDbms() in (DBMS.MYSQL,):
|
||||
retVal = getUnicode(struct.pack('B' if value < 256 else '<H', value))
|
||||
elif value > 255:
|
||||
retVal = unichr(value)
|
||||
else:
|
||||
retVal = getUnicode(chr(value))
|
||||
except:
|
||||
retVal = INFERENCE_UNKNOWN_CHAR
|
||||
|
||||
return retVal
|
||||
|
||||
def unhandledExceptionMessage():
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user