Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97ccf4c

Browse files
committed
Minor patch
1 parent 8cc516d commit 97ccf4c

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

lib/core/common.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -938,9 +938,10 @@ def setColor(message, color=None, bold=False, level=None, istty=None):
938938
"""
939939

940940
retVal = message
941-
level = level or extractRegexResult(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
942941

943942
if message and (IS_TTY or istty) and not conf.get("disableColoring"): # colorizing handler
943+
level = level or extractRegexResult(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
944+
944945
if bold or color:
945946
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)
946947
elif level:
@@ -974,7 +975,7 @@ def clearColors(message):
974975

975976
return retVal
976977

977-
def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=CONTENT_STATUS.IN_PROGRESS):
978+
def dataToStdout(data, forceOutput=False, bold=False, contentType=None, status=CONTENT_STATUS.IN_PROGRESS, coloring=True):
978979
"""
979980
Writes text to the stdout (console) stream
980981
"""
@@ -987,9 +988,9 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
987988

988989
try:
989990
if conf.get("api"):
990-
sys.stdout.write(stdoutEncode(clearColors(data)), status, content_type)
991+
sys.stdout.write(stdoutEncode(clearColors(data)), status, contentType)
991992
else:
992-
sys.stdout.write(stdoutEncode(setColor(data, bold=bold)))
993+
sys.stdout.write(stdoutEncode(setColor(data, bold=bold) if coloring else clearColors(data)))
993994

994995
sys.stdout.flush()
995996
except IOError:

lib/core/dump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _write(self, data, newline=True, console=True, content_type=None):
7272
text = "%s%s" % (data, "\n" if newline else " ")
7373

7474
if conf.api:
75-
dataToStdout(data, content_type=content_type, status=CONTENT_STATUS.COMPLETE)
75+
dataToStdout(data, contentType=content_type, status=CONTENT_STATUS.COMPLETE)
7676

7777
elif console:
7878
dataToStdout(text)

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.3.1"
21+
VERSION = "1.4.3.2"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/testing.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import time
1919

2020
from extra.vulnserver import vulnserver
21-
from lib.core.common import clearColors
2221
from lib.core.common import clearConsoleLine
2322
from lib.core.common import dataToStdout
2423
from lib.core.common import randomInt
@@ -132,7 +131,7 @@ def _thread():
132131

133132
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:
134133
dataToStdout("---\n\n$ %s\n" % cmd)
135-
dataToStdout("%s---\n" % clearColors(output))
134+
dataToStdout("%s---\n" % output, coloring=False)
136135
retVal = False
137136

138137
count += 1
@@ -233,7 +232,7 @@ def bedTest():
233232
if check not in output:
234233
print(cmd, check)
235234
dataToStdout("---\n\n$ %s\n" % cmd)
236-
dataToStdout("%s---\n" % clearColors(output))
235+
dataToStdout("%s---\n" % output, coloring=False)
237236
retVal = False
238237

239238
count += 1
@@ -297,7 +296,7 @@ def _thread():
297296

298297
if "Traceback" in output:
299298
dataToStdout("---\n\n$ %s\n" % cmd)
300-
dataToStdout("%s---\n" % clearColors(output))
299+
dataToStdout("%s---\n" % output, coloring=False)
301300

302301
handle, config = tempfile.mkstemp(prefix="sqlmapcrash", suffix=".conf")
303302
os.close(handle)

0 commit comments

Comments
 (0)