diff --git a/lib/core/log.py b/lib/core/log.py index bf6b22cac..50122a227 100644 --- a/lib/core/log.py +++ b/lib/core/log.py @@ -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) diff --git a/lib/core/option.py b/lib/core/option.py index 11f9aad1b..a498c7ab1 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -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 diff --git a/lib/request/proxy.py b/lib/request/proxy.py index e52d6700e..296fb740a 100644 --- a/lib/request/proxy.py +++ b/lib/request/proxy.py @@ -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} diff --git a/plugins/generic/databases.py b/plugins/generic/databases.py index 7c2fd47df..9d4956366 100644 --- a/plugins/generic/databases.py +++ b/plugins/generic/databases.py @@ -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 diff --git a/thirdparty/ansistrm/ansistrm.py b/thirdparty/ansistrm/ansistrm.py index 899accc2e..c4db309af 100644 --- a/thirdparty/ansistrm/ansistrm.py +++ b/thirdparty/ansistrm/ansistrm.py @@ -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