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

Skip to content

Commit f38596a

Browse files
committed
Minor refactoring
1 parent 5ff54bf commit f38596a

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

lib/core/common.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,21 @@ def setColor(message, bold=False):
889889

890890
return retVal
891891

892+
def clearColors(message):
893+
"""
894+
Clears ANSI color codes
895+
896+
>>> clearColors("\x1b[38;5;82mHello \x1b[38;5;198mWorld")
897+
'Hello World'
898+
"""
899+
900+
retVal = message
901+
902+
if message:
903+
retVal = re.sub(r"\x1b\[[\d;]+m", "", message)
904+
905+
return retVal
906+
892907
def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=CONTENT_STATUS.IN_PROGRESS):
893908
"""
894909
Writes text to the stdout (console) stream
@@ -1178,7 +1193,7 @@ def banner():
11781193
_ = BANNER
11791194

11801195
if not getattr(LOGGER_HANDLER, "is_tty", False) or "--disable-coloring" in sys.argv:
1181-
_ = re.sub("\033.+?m", "", _)
1196+
_ = clearColors(_)
11821197
elif IS_WIN:
11831198
coloramainit()
11841199

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

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

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ a7b0c8e5a18a3abe8803999dcfc4664f lib/controller/handler.py
2727
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
2828
e3a3f5218b2e52dd0afafdfc9fed2002 lib/core/agent.py
2929
86a4703d5474badd8462146510b2c460 lib/core/bigarray.py
30-
17ab0324cb992a781cc197ec8c0209d7 lib/core/common.py
30+
32a77cc3fc2d26d26f469ab8eb35efed lib/core/common.py
3131
2a40d5b5997265daa890545d4a4a59b9 lib/core/convert.py
3232
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
3333
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
@@ -46,7 +46,7 @@ ffa5f01f39b17c8d73423acca6cfe86a lib/core/readlineng.py
4646
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
4747
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
4848
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
49-
7735e472a2d2661744bd6d04fd1c387d lib/core/settings.py
49+
feb9124da962dd30ab7fcecc4a60f5d3 lib/core/settings.py
5050
d0adc28a38e43a787df4471f7f027413 lib/core/shell.py
5151
63491be462c515a1a3880c27c2acc4a2 lib/core/subprocessng.py
5252
505aaa61e1bba3c3d4567c3e667699e3 lib/core/target.py

0 commit comments

Comments
 (0)