mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 11:45:46 +03:00
Dealing with kb.currentMessage issue
This commit is contained in:
parent
b320dc118d
commit
9bc24cea6b
|
@ -697,21 +697,19 @@ def singleTimeLogMessage(message, level=logging.INFO, flag=None):
|
||||||
|
|
||||||
def setColor(message, bold=False):
|
def setColor(message, bold=False):
|
||||||
retVal = message
|
retVal = message
|
||||||
level = extractRegexResult(r"\[(?P<result>[A-Z ]+)\]", message)
|
level = extractRegexResult(r"\[(?P<result>[A-Z ]+)\]", message) or kb.get("stickyLevel")
|
||||||
|
|
||||||
if level:
|
|
||||||
kb.currentMessage = level
|
|
||||||
|
|
||||||
if hasattr(LOGGER_HANDLER, "level_map"): # colorizing handler
|
if hasattr(LOGGER_HANDLER, "level_map"): # colorizing handler
|
||||||
if bold:
|
if bold:
|
||||||
retVal = colored(message, color=None, on_color=None, attrs=("bold",))
|
retVal = colored(message, color=None, on_color=None, attrs=("bold",))
|
||||||
elif hasattr(kb, "currentMessage") and kb.currentMessage:
|
elif level:
|
||||||
_ = LOGGER_HANDLER.level_map.get(logging.getLevelName(kb.currentMessage))
|
_ = LOGGER_HANDLER.level_map.get(logging.getLevelName(level))
|
||||||
|
|
||||||
if _:
|
if _:
|
||||||
background, foreground, bold = _
|
background, foreground, bold = _
|
||||||
retVal = colored(message, color=foreground, on_color="on_%s" % background if background else None, attrs=("bold",) if bold else None)
|
retVal = colored(message, color=foreground, on_color="on_%s" % background if background else None, attrs=("bold",) if bold else None)
|
||||||
|
|
||||||
|
kb.stickyLevel = level if message and message[-1] != "\n" else None
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def dataToStdout(data, forceOutput=False, bold=False):
|
def dataToStdout(data, forceOutput=False, bold=False):
|
||||||
|
|
|
@ -1436,7 +1436,6 @@ def __setKnowledgeBaseAttributes(flushAll=True):
|
||||||
|
|
||||||
kb.commonOutputs = None
|
kb.commonOutputs = None
|
||||||
kb.counters = {}
|
kb.counters = {}
|
||||||
kb.currentMessage = None
|
|
||||||
kb.data = AttribDict()
|
kb.data = AttribDict()
|
||||||
kb.dataOutputFlag = False
|
kb.dataOutputFlag = False
|
||||||
|
|
||||||
|
@ -1511,6 +1510,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
|
||||||
kb.singleLogFlags = set()
|
kb.singleLogFlags = set()
|
||||||
kb.skipOthersDbms = None
|
kb.skipOthersDbms = None
|
||||||
kb.stickyFlag = False
|
kb.stickyFlag = False
|
||||||
|
kb.stickyLevel = None
|
||||||
kb.suppressResumeInfo = False
|
kb.suppressResumeInfo = False
|
||||||
kb.technique = None
|
kb.technique = None
|
||||||
kb.testMode = False
|
kb.testMode = False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user