Minor refactoring

This commit is contained in:
Miroslav Stampar 2013-01-16 16:33:04 +01:00
parent 053b7d12b4
commit 14b7e655a9
5 changed files with 3 additions and 10 deletions

View File

@ -6,11 +6,9 @@ See the file 'doc/COPYING' for copying permission
"""
import logging
import StringIO
import sys
from lib.core.enums import CUSTOM_LOGGING
from thirdparty.ansistrm.ansistrm import ColorizingStreamHandler
logging.addLevelName(CUSTOM_LOGGING.PAYLOAD, "PAYLOAD")
logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_OUT, "TRAFFIC OUT")
@ -20,7 +18,8 @@ LOGGER = logging.getLogger("sqlmapLog")
LOGGER_HANDLER = None
try:
import ctypes
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)

View File

@ -54,7 +54,6 @@ from lib.core.common import urldecode
from lib.core.common import urlencode
from lib.core.convert import base64pickle
from lib.core.convert import base64unpickle
from lib.core.convert import jsonize
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger

View File

@ -11,8 +11,6 @@ import ssl
import urllib
import urllib2
from lib.core.exception import SqlmapUnsupportedFeatureException
class ProxyHTTPConnection(httplib.HTTPConnection):
_ports = {"http": 80, "https": 443}

View File

@ -13,7 +13,6 @@ from lib.core.common import getLimitRange
from lib.core.common import isInferenceAvailable
from lib.core.common import isListLike
from lib.core.common import isNoneValue
from lib.core.common import isNullValue
from lib.core.common import isNumPosStrValue
from lib.core.common import isTechniqueAvailable
from lib.core.common import parseSqliteTableSchema

View File

@ -1,6 +1,7 @@
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
#
import ctypes
import logging
import os
import re
@ -69,7 +70,6 @@ class ColorizingStreamHandler(logging.StreamHandler):
def output_colorized(self, message):
self.stream.write(message)
else:
import re
ansi_esc = re.compile(r'\x1b\[((?:\d+)(?:;(?:\d+))*)m')
nt_color_map = {
@ -84,8 +84,6 @@ class ColorizingStreamHandler(logging.StreamHandler):
}
def output_colorized(self, message):
import ctypes
parts = self.ansi_esc.split(message)
write = self.stream.write
h = None