diff --git a/lib/core/common.py b/lib/core/common.py index 3a3b99d25..7e5f5bb4d 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -750,7 +750,7 @@ def dataToStdout(data, forceOutput=False, bold=False): if kb.get("multiThreadMode"): logging._releaseLock() - setFormatterPrependFlag(len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n') + kb.prependFlag = len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n' def dataToTrafficFile(data): if not conf.trafficFile: @@ -1559,7 +1559,9 @@ def clearConsoleLine(forceOutput=False): """ dataToStdout("\r%s\r" % (" " * (getConsoleWidth() - 1)), forceOutput) - setFormatterPrependFlag(False) + + kb.prependFlag = False + kb.stickyLevel = None def parseXmlFile(xmlFile, handler): """ @@ -3158,14 +3160,6 @@ def extractExpectedValue(value, expected): return value -def setFormatterPrependFlag(value=True): - """ - Sets logging formatter flag used for signaling if newline is needed before - the logging message itself (used in inference mode) - """ - - FORMATTER._prepend_flag = value - def hashDBWrite(key, value, serialize=False): """ Helper function for writing session data to HashDB diff --git a/lib/core/option.py b/lib/core/option.py index d23605052..181e54131 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -411,13 +411,12 @@ def __adjustLoggingFormatter(): def format(record): _ = FORMATTER._format(record) - if FORMATTER._prepend_flag: + if kb.prependFlag: _ = "\n%s" % _ - FORMATTER._prepend_flag = False + kb.prependFlag = False return _ FORMATTER._format = FORMATTER.format - FORMATTER._prepend_flag = False FORMATTER.format = format def __setRequestFromFile(): @@ -1497,6 +1496,7 @@ def __setKnowledgeBaseAttributes(flushAll=True): kb.pageStable = None kb.partRun = None kb.permissionFlag = False + kb.prependFlag = False kb.processResponseCounter = 0 kb.proxyAuthHeader = None kb.queryCounter = 0 diff --git a/lib/techniques/blind/inference.py b/lib/techniques/blind/inference.py index 27f659dc5..4409fdbab 100644 --- a/lib/techniques/blind/inference.py +++ b/lib/techniques/blind/inference.py @@ -26,7 +26,6 @@ from lib.core.common import hashDBWrite from lib.core.common import incrementCounter from lib.core.common import randomStr from lib.core.common import safeStringFormat -from lib.core.common import setFormatterPrependFlag from lib.core.common import singleTimeWarnMessage from lib.core.data import conf from lib.core.data import kb @@ -525,7 +524,8 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None except KeyboardInterrupt: abortedFlag = True finally: - setFormatterPrependFlag(False) + kb.prependFlag = False + kb.stickyLevel = None if finalValue is not None: finalValue = decodeHexValue(finalValue) if conf.hexConvert else finalValue