This commit is contained in:
Miroslav Stampar 2021-10-26 10:05:14 +02:00
parent 8a57002b26
commit cceb5319ef
3 changed files with 19 additions and 2 deletions

View File

@ -1431,6 +1431,19 @@ def cleanQuery(query):
return retVal
def cleanReplaceUnicode(value):
"""
Cleans unicode for proper encode/decode
>>> cleanReplaceUnicode(['a', 'b'])
['a', 'b']
"""
def clean(value):
return value.encode(UNICODE_ENCODING, errors="replace").decode(UNICODE_ENCODING) if isinstance(value, six.text_type) else value
return applyFunctionRecursively(value, clean)
def setPaths(rootPath):
"""
Sets absolute paths for project directories and files

View File

@ -7,6 +7,7 @@ See the file 'LICENSE' for copying permission
import sqlite3
from lib.core.common import cleanReplaceUnicode
from lib.core.common import getSafeExString
from lib.core.common import unsafeSQLIdentificatorNaming
from lib.core.exception import SqlmapConnectionException
@ -81,7 +82,10 @@ class Replication(object):
def execute(self, sql, parameters=None):
try:
self.parent.cursor.execute(sql, parameters or [])
try:
self.parent.cursor.execute(sql, parameters or [])
except UnicodeError:
self.parent.cursor.execute(sql, cleanReplaceUnicode(parameters or []))
except sqlite3.OperationalError as ex:
errMsg = "problem occurred ('%s') while accessing sqlite database " % getSafeExString(ex, UNICODE_ENCODING)
errMsg += "located at '%s'. Please make sure that " % self.parent.dbpath

View File

@ -20,7 +20,7 @@ from thirdparty import six
from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.5.10.17"
VERSION = "1.5.10.18"
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)