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

Skip to content

Commit 6cd0b11

Browse files
committed
Minor update
1 parent 97ccf4c commit 6cd0b11

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,12 +935,20 @@ def setColor(message, color=None, bold=False, level=None, istty=None):
935935
936936
>>> setColor("Hello World", color="red", istty=True)
937937
'\\x1b[31mHello World\\x1b[0m'
938+
>>> setColor("[INFO] Hello World", istty=True)
939+
'[\\x1b[32mINFO\\x1b[0m] Hello World'
940+
>>> setColor("[INFO] Hello [CRITICAL] World", istty=True)
941+
'[INFO] Hello [CRITICAL] World'
938942
"""
939943

940944
retVal = message
941945

942946
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)
947+
if level is None:
948+
levels = re.findall(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
949+
950+
if len(levels) == 1:
951+
level = levels[0]
944952

945953
if bold or color:
946954
retVal = colored(message, color=color, on_color=None, attrs=("bold",) if bold else None)

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.2"
21+
VERSION = "1.4.3.3"
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)