From 97ccf4ca66701f78d8b60372f9869a54578a98d9 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 6 Mar 2020 12:21:26 +0100 Subject: [PATCH] Minor patch --- lib/core/common.py | 9 +++++---- lib/core/dump.py | 2 +- lib/core/settings.py | 2 +- lib/core/testing.py | 7 +++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 06b6d2a33..1f9937210 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -938,9 +938,10 @@ def setColor(message, color=None, bold=False, level=None, istty=None): """ retVal = message - level = level or extractRegexResult(r"\[(?P%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message) if message and (IS_TTY or istty) and not conf.get("disableColoring"): # colorizing handler + level = level or extractRegexResult(r"\[(?P%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message) + if bold or color: retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None) elif level: @@ -974,7 +975,7 @@ def clearColors(message): return retVal -def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=CONTENT_STATUS.IN_PROGRESS): +def dataToStdout(data, forceOutput=False, bold=False, contentType=None, status=CONTENT_STATUS.IN_PROGRESS, coloring=True): """ Writes text to the stdout (console) stream """ @@ -987,9 +988,9 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status= try: if conf.get("api"): - sys.stdout.write(stdoutEncode(clearColors(data)), status, content_type) + sys.stdout.write(stdoutEncode(clearColors(data)), status, contentType) else: - sys.stdout.write(stdoutEncode(setColor(data, bold=bold))) + sys.stdout.write(stdoutEncode(setColor(data, bold=bold) if coloring else clearColors(data))) sys.stdout.flush() except IOError: diff --git a/lib/core/dump.py b/lib/core/dump.py index 925bc5914..4cd4adf9d 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -72,7 +72,7 @@ class Dump(object): text = "%s%s" % (data, "\n" if newline else " ") if conf.api: - dataToStdout(data, content_type=content_type, status=CONTENT_STATUS.COMPLETE) + dataToStdout(data, contentType=content_type, status=CONTENT_STATUS.COMPLETE) elif console: dataToStdout(text) diff --git a/lib/core/settings.py b/lib/core/settings.py index 21a2f4901..685e4d0f3 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.4.3.1" +VERSION = "1.4.3.2" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/lib/core/testing.py b/lib/core/testing.py index 45b1b394d..6568fb3da 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -18,7 +18,6 @@ import threading import time from extra.vulnserver import vulnserver -from lib.core.common import clearColors from lib.core.common import clearConsoleLine from lib.core.common import dataToStdout from lib.core.common import randomInt @@ -132,7 +131,7 @@ def vulnTest(): if not all((check in output if not check.startswith('~') else check[1:] not in output) for check in checks) or "unhandled exception" in output: dataToStdout("---\n\n$ %s\n" % cmd) - dataToStdout("%s---\n" % clearColors(output)) + dataToStdout("%s---\n" % output, coloring=False) retVal = False count += 1 @@ -233,7 +232,7 @@ def bedTest(): if check not in output: print(cmd, check) dataToStdout("---\n\n$ %s\n" % cmd) - dataToStdout("%s---\n" % clearColors(output)) + dataToStdout("%s---\n" % output, coloring=False) retVal = False count += 1 @@ -297,7 +296,7 @@ def fuzzTest(): if "Traceback" in output: dataToStdout("---\n\n$ %s\n" % cmd) - dataToStdout("%s---\n" % clearColors(output)) + dataToStdout("%s---\n" % output, coloring=False) handle, config = tempfile.mkstemp(prefix="sqlmapcrash", suffix=".conf") os.close(handle)