Patch regarding #4066

This commit is contained in:
Miroslav Stampar 2020-01-09 11:59:50 +01:00
parent 71b33e5956
commit eb3a3b4825
3 changed files with 7 additions and 4 deletions

View File

@ -227,7 +227,7 @@ def encodeBase64(value, binary=True, encoding=None):
return retVal
def getBytes(value, encoding=UNICODE_ENCODING, errors="strict", unsafe=True):
def getBytes(value, encoding=None, errors="strict", unsafe=True):
"""
Returns byte representation of provided Unicode value
@ -237,9 +237,12 @@ def getBytes(value, encoding=UNICODE_ENCODING, errors="strict", unsafe=True):
retVal = value
if encoding is None:
encoding = conf.encoding or UNICODE_ENCODING
try:
codecs.lookup(encoding)
except LookupError:
except (LookupError, TypeError):
encoding = UNICODE_ENCODING
if isinstance(value, six.text_type):

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.4.1.19"
VERSION = "1.4.1.20"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -26,6 +26,6 @@ class Syntax(GenericSyntax):
if all(_ < 128 for _ in getOrds(value)):
return "0x%s" % getUnicode(binascii.hexlify(getBytes(value)))
else:
return "CONVERT(0x%s USING utf8)" % getUnicode(binascii.hexlify(getBytes(value)))
return "CONVERT(0x%s USING utf8)" % getUnicode(binascii.hexlify(getBytes(value, "utf8")))
return Syntax._escape(expression, quote, escaper)