mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Some more refactoring
This commit is contained in:
parent
d7926b8aac
commit
c6464b44be
|
@ -78,8 +78,10 @@ from lib.core.exception import sqlmapMissingDependence
|
|||
from lib.core.exception import sqlmapSilentQuitException
|
||||
from lib.core.exception import sqlmapSyntaxException
|
||||
from lib.core.log import FORMATTER
|
||||
from lib.core.log import LEVEL_ATTRS
|
||||
from lib.core.log import LEVEL_COLORS
|
||||
from lib.core.log import LEVEL_ON_COLORS
|
||||
from lib.core.optiondict import optDict
|
||||
from lib.core.settings import COLOR_MAP
|
||||
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
|
||||
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
|
||||
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
|
||||
|
@ -696,14 +698,12 @@ def singleTimeLogMessage(message, level=logging.INFO, flag=None):
|
|||
logger.log(level, message)
|
||||
|
||||
def setColor(message, bold=False):
|
||||
retVal = message
|
||||
level = extractRegexResult(r"\A\s*\[(?P<result>[A-Z ]+)\]", message)
|
||||
|
||||
if level:
|
||||
attrs = ('bold',) if (level == "CRITICAL" or bold) else None
|
||||
on_color = 'on_red' if level == "CRITICAL" else None
|
||||
color = COLOR_MAP.get(level)
|
||||
retVal = colored(message, color=color, on_color=on_color, attrs=attrs)
|
||||
retVal = colored(message, color=LEVEL_COLORS.get(level), on_color=LEVEL_ON_COLORS.get(level), attrs=LEVEL_ATTRS.get(level))
|
||||
else:
|
||||
retVal = message
|
||||
|
||||
return retVal
|
||||
|
||||
|
|
|
@ -18,6 +18,26 @@ logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_IN, "TRAFFIC IN")
|
|||
|
||||
LOGGER = logging.getLogger("sqlmapLog")
|
||||
|
||||
LEVEL_COLORS = {
|
||||
"CRITICAL": "white",
|
||||
"ERROR": "red",
|
||||
"WARNING": "yellow",
|
||||
"INFO": "green",
|
||||
"DEBUG": "blue",
|
||||
"PAYLOAD": "magenta",
|
||||
"TRAFFIC OUT": "cyan",
|
||||
"TRAFFIC IN": "grey"
|
||||
}
|
||||
|
||||
LEVEL_ON_COLORS = {
|
||||
"CRITICAL": "on_red",
|
||||
}
|
||||
|
||||
LEVEL_ATTRS = {
|
||||
"CRITICAL": ('bold',),
|
||||
}
|
||||
|
||||
|
||||
try:
|
||||
import ctypes
|
||||
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
|
||||
|
|
|
@ -268,17 +268,6 @@ BASIC_HELP_ITEMS = (
|
|||
"wizard"
|
||||
)
|
||||
|
||||
COLOR_MAP = {
|
||||
"CRITICAL": "white",
|
||||
"ERROR": "red",
|
||||
"WARNING": "yellow",
|
||||
"INFO": "green",
|
||||
"DEBUG": "blue",
|
||||
"PAYLOAD": "magenta",
|
||||
"TRAFFIC OUT": "cyan",
|
||||
"TRAFFIC IN": "grey"
|
||||
}
|
||||
|
||||
# string representation for NULL value
|
||||
NULL = "NULL"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user