From 6e06df3d39fc6c0b1d768aec0ade605f9fbabe84 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 12 Dec 2019 14:10:02 +0100 Subject: [PATCH] Minor bug fix --- plugins/generic/databases.py | 2 +- plugins/generic/syntax.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/generic/databases.py b/plugins/generic/databases.py index 7f80357b5..0f04f4015 100644 --- a/plugins/generic/databases.py +++ b/plugins/generic/databases.py @@ -901,7 +901,7 @@ class Databases(object): self.getTables() infoMsg = "fetched tables: " - infoMsg += ", ".join(["%s" % ", ".join("%s%s%s" % (unsafeSQLIdentificatorNaming(db), ".." if Backend.isDbms(DBMS.MSSQL) or Backend.isDbms(DBMS.SYBASE) else '.', unsafeSQLIdentificatorNaming(_)) for _ in tbl) for db, tbl in kb.data.cachedTables.items()]) + infoMsg += ", ".join(["%s" % ", ".join("'%s%s%s'" % (unsafeSQLIdentificatorNaming(db), ".." if Backend.isDbms(DBMS.MSSQL) or Backend.isDbms(DBMS.SYBASE) else '.', unsafeSQLIdentificatorNaming(_)) for _ in tbl) for db, tbl in kb.data.cachedTables.items()]) logger.info(infoMsg) for db, tables in kb.data.cachedTables.items(): diff --git a/plugins/generic/syntax.py b/plugins/generic/syntax.py index 5a5b1e0e1..bb0bee737 100644 --- a/plugins/generic/syntax.py +++ b/plugins/generic/syntax.py @@ -28,13 +28,16 @@ class Syntax(object): if quote: for item in re.findall(r"'[^']*'+", expression): original = item[1:-1] - if original and re.search(r"\[(SLEEPTIME|RAND)", original) is None: # e.g. '[SLEEPTIME]' marker - replacement = escaper(original) if not conf.noEscape else original + if original: + if Backend.isDbms(DBMS.SQLITE) and "X%s" % item in expression: + continue + if re.search(r"\[(SLEEPTIME|RAND)", original) is None: # e.g. '[SLEEPTIME]' marker + replacement = escaper(original) if not conf.noEscape else original - if replacement != original: - retVal = retVal.replace(item, replacement) - elif len(original) != len(getBytes(original)) and "n'%s'" % original not in retVal and Backend.getDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.ORACLE, DBMS.MSSQL): - retVal = retVal.replace("'%s'" % original, "n'%s'" % original) + if replacement != original: + retVal = retVal.replace(item, replacement) + elif len(original) != len(getBytes(original)) and "n'%s'" % original not in retVal and Backend.getDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.ORACLE, DBMS.MSSQL): + retVal = retVal.replace("'%s'" % original, "n'%s'" % original) else: retVal = escaper(expression)