diff --git a/lib/core/agent.py b/lib/core/agent.py index d010eac5b..25a050d9d 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -351,7 +351,8 @@ class Agent(object): else: nulledCastedField = rootQuery.isnull.query % nulledCastedField - if conf.hexConvert or conf.binaryFields and field in conf.binaryFields.split(','): + kb.binaryField = conf.binaryFields and field in conf.binaryFields.split(',') + if conf.hexConvert or kb.binaryField: nulledCastedField = self.hexConvertField(nulledCastedField) return nulledCastedField diff --git a/lib/core/common.py b/lib/core/common.py index 00f3be6ef..81a60e601 100755 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -3478,18 +3478,19 @@ def decodeHexValue(value): if value and isinstance(value, basestring) and len(value) % 2 == 0: retVal = hexdecode(retVal) - if Backend.isDbms(DBMS.MSSQL) and value.startswith("0x"): - try: - retVal = retVal.decode("utf-16-le") - except UnicodeDecodeError: - pass - elif Backend.isDbms(DBMS.HSQLDB): - try: - retVal = retVal.decode("utf-16-be") - except UnicodeDecodeError: - pass - if not isinstance(retVal, unicode): - retVal = getUnicode(retVal, "utf8") + if not kb.binaryField: + if Backend.isDbms(DBMS.MSSQL) and value.startswith("0x"): + try: + retVal = retVal.decode("utf-16-le") + except UnicodeDecodeError: + pass + elif Backend.isDbms(DBMS.HSQLDB): + try: + retVal = retVal.decode("utf-16-be") + except UnicodeDecodeError: + pass + if not isinstance(retVal, unicode): + retVal = getUnicode(retVal, "utf8") return retVal diff --git a/lib/core/option.py b/lib/core/option.py index 7e3f878e6..2ac87d8f7 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1572,6 +1572,7 @@ def _setKnowledgeBaseAttributes(flushAll=True): kb.arch = None kb.authHeader = None kb.bannerFp = AttribDict() + kb.binaryField = False kb.brute = AttribDict({"tables": [], "columns": []}) kb.bruteMode = False