setup for implementing logging colouring - issue #77

This commit is contained in:
Bernardo Damele 2012-07-10 02:54:37 +01:00
parent a14b7e6b6b
commit eb7ffb8f91
4 changed files with 3 additions and 18 deletions

View File

@ -76,6 +76,7 @@ from lib.core.exception import sqlmapNoneDataException
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.optiondict import optDict
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
@ -87,7 +88,6 @@ from lib.core.settings import DBMS_DICT
from lib.core.settings import DBMS_DIRECTORY_DICT
from lib.core.settings import DESCRIPTION
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
from lib.core.settings import FORMATTER
from lib.core.settings import NULL
from lib.core.settings import HASHDB_MILESTONE_VALUE
from lib.core.settings import IS_WIN

View File

@ -6,7 +6,7 @@ See the file 'doc/COPYING' for copying permission
"""
from lib.core.datatype import AttribDict
from lib.core.settings import LOGGER
from lib.core.log import LOGGER
# sqlmap paths
paths = AttribDict()

View File

@ -75,6 +75,7 @@ from lib.core.exception import sqlmapSilentQuitException
from lib.core.exception import sqlmapSyntaxException
from lib.core.exception import sqlmapUnsupportedDBMSException
from lib.core.exception import sqlmapUserQuitException
from lib.core.log import FORMATTER
from lib.core.optiondict import optDict
from lib.core.purge import purge
from lib.core.settings import CODECS_LIST_PAGE
@ -83,7 +84,6 @@ from lib.core.settings import DEFAULT_GET_POST_DELIMITER
from lib.core.settings import DEFAULT_PAGE_ENCODING
from lib.core.settings import DEFAULT_TOR_HTTP_PORTS
from lib.core.settings import DEFAULT_TOR_SOCKS_PORT
from lib.core.settings import FORMATTER
from lib.core.settings import IS_WIN
from lib.core.settings import NULL
from lib.core.settings import PYVERSION

View File

@ -5,14 +5,12 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import logging
import os
import re
import subprocess
import string
import sys
from lib.core.enums import CUSTOM_LOGGING
from lib.core.enums import DBMS
from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.revision import getRevisionNumber
@ -35,19 +33,6 @@ CONSTANT_RATIO = 0.9
LOWER_RATIO_BOUND = 0.02
UPPER_RATIO_BOUND = 0.98
# sqlmap logger
logging.addLevelName(CUSTOM_LOGGING.PAYLOAD, "PAYLOAD")
logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_OUT, "TRAFFIC OUT")
logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_IN, "TRAFFIC IN")
LOGGER = logging.getLogger("sqlmapLog")
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S")
LOGGER_HANDLER.setFormatter(FORMATTER)
LOGGER.addHandler(LOGGER_HANDLER)
LOGGER.setLevel(logging.WARN)
# markers for special cases when parameter values contain html encoded characters
PARAMETER_AMP_MARKER = "__AMP__"
PARAMETER_SEMICOLON_MARKER = "__SEMICOLON__"