mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-20 14:39:02 +00:00
Minor refactoring
This commit is contained in:
@@ -889,6 +889,21 @@ def setColor(message, bold=False):
|
||||
|
||||
return retVal
|
||||
|
||||
def clearColors(message):
|
||||
"""
|
||||
Clears ANSI color codes
|
||||
|
||||
>>> clearColors("\x1b[38;5;82mHello \x1b[38;5;198mWorld")
|
||||
'Hello World'
|
||||
"""
|
||||
|
||||
retVal = message
|
||||
|
||||
if message:
|
||||
retVal = re.sub(r"\x1b\[[\d;]+m", "", message)
|
||||
|
||||
return retVal
|
||||
|
||||
def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=CONTENT_STATUS.IN_PROGRESS):
|
||||
"""
|
||||
Writes text to the stdout (console) stream
|
||||
@@ -1178,7 +1193,7 @@ def banner():
|
||||
_ = BANNER
|
||||
|
||||
if not getattr(LOGGER_HANDLER, "is_tty", False) or "--disable-coloring" in sys.argv:
|
||||
_ = re.sub("\033.+?m", "", _)
|
||||
_ = clearColors(_)
|
||||
elif IS_WIN:
|
||||
coloramainit()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||
from lib.core.enums import OS
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.2.2.13"
|
||||
VERSION = "1.2.2.14"
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user