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

Skip to content

Commit 55595ed

Browse files
committed
Fixes #4165
1 parent aaa0c5c commit 55595ed

2 files changed

Lines changed: 29 additions & 20 deletions

File tree

lib/core/common.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -943,28 +943,31 @@ def setColor(message, color=None, bold=False, level=None, istty=None):
943943

944944
retVal = message
945945

946-
if message and (IS_TTY or istty) and not conf.get("disableColoring"): # colorizing handler
947-
if level is None:
948-
levels = re.findall(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
946+
if message:
947+
if (IS_TTY or istty) and not conf.get("disableColoring"): # colorizing handler
948+
if level is None:
949+
levels = re.findall(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
949950

950-
if len(levels) == 1:
951-
level = levels[0]
951+
if len(levels) == 1:
952+
level = levels[0]
952953

953-
if bold or color:
954-
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)
955-
elif level:
956-
try:
957-
level = getattr(logging, level, None)
958-
except:
959-
level = None
960-
retVal = LOGGER_HANDLER.colorize(message, level)
961-
else:
962-
match = re.search(r"\(([^)]*)\s*fork\)", message)
963-
if match:
964-
retVal = retVal.replace(match.group(1), colored(match.group(1), color="lightgrey"))
954+
if bold or color:
955+
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)
956+
elif level:
957+
try:
958+
level = getattr(logging, level, None)
959+
except:
960+
level = None
961+
retVal = LOGGER_HANDLER.colorize(message, level)
962+
else:
963+
match = re.search(r"\(([^)]*)\s*fork\)", message)
964+
if match:
965+
retVal = retVal.replace(match.group(1), colored(match.group(1), color="lightgrey"))
966+
967+
for match in re.finditer(r"([^\w])'([^\n']+)'", message): # single-quoted (Note: watch-out for the banner)
968+
retVal = retVal.replace(match.group(0), "%s'%s'" % (match.group(1), colored(match.group(2), color="lightgrey")))
965969

966-
for match in re.finditer(r"([^\w])'([^\n']+)'", message): # single-quoted (Note: watch-out for the banner)
967-
retVal = retVal.replace(match.group(0), "%s'%s'" % (match.group(1), colored(match.group(2), color="lightgrey")))
970+
message = message.strip()
968971

969972
return retVal
970973

@@ -988,6 +991,12 @@ def dataToStdout(data, forceOutput=False, bold=False, contentType=None, status=C
988991
Writes text to the stdout (console) stream
989992
"""
990993

994+
if not IS_TTY and isinstance(data, six.string_types) and data.startswith("\r"):
995+
if re.search(r"\(\d+%\)", data):
996+
data = ""
997+
else:
998+
data = "\n%s" % data.strip("\r")
999+
9911000
if not kb.get("threadException"):
9921001
if forceOutput or not (getCurrentThreadData().disableStdOut or kb.get("wizardMode")):
9931002
multiThreadMode = isMultiThreadMode()

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.4.3"
21+
VERSION = "1.4.4.4"
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)

0 commit comments

Comments
 (0)