mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
minor bug fix to make --disable-coloring work on log messages too
This commit is contained in:
parent
2fa2f30d21
commit
5c8335876f
|
@ -729,6 +729,9 @@ def boldifyMessage(message):
|
|||
return retVal
|
||||
|
||||
def setColor(message, bold=False):
|
||||
if conf.disableColoring:
|
||||
return message
|
||||
|
||||
retVal = message
|
||||
level = extractRegexResult(r"\[(?P<result>[A-Z ]+)\]", message) or kb.get("stickyLevel")
|
||||
|
||||
|
|
|
@ -20,10 +20,20 @@ LOGGER_HANDLER = None
|
|||
try:
|
||||
from thirdparty.ansistrm.ansistrm import ColorizingStreamHandler
|
||||
|
||||
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
|
||||
LOGGER_HANDLER.level_map[logging.getLevelName("PAYLOAD")] = (None, "cyan", False)
|
||||
LOGGER_HANDLER.level_map[logging.getLevelName("TRAFFIC OUT")] = (None, "magenta", False)
|
||||
LOGGER_HANDLER.level_map[logging.getLevelName("TRAFFIC IN")] = ("magenta", None, False)
|
||||
disableColoring = False
|
||||
|
||||
for argument in sys.argv:
|
||||
if "disable-col" in argument:
|
||||
disableColoring = True
|
||||
break
|
||||
|
||||
if disableColoring:
|
||||
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
|
||||
else:
|
||||
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
|
||||
LOGGER_HANDLER.level_map[logging.getLevelName("PAYLOAD")] = (None, "cyan", False)
|
||||
LOGGER_HANDLER.level_map[logging.getLevelName("TRAFFIC OUT")] = (None, "magenta", False)
|
||||
LOGGER_HANDLER.level_map[logging.getLevelName("TRAFFIC IN")] = ("magenta", None, False)
|
||||
except ImportError:
|
||||
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user