This commit is contained in:
Miroslav Stampar 2018-07-06 16:18:04 +02:00
parent b44551230e
commit e84142b6a9
3 changed files with 33 additions and 29 deletions

View File

@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.2.7.7" VERSION = "1.2.7.8"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -45,6 +45,7 @@ class ColorizingStreamHandler(logging.StreamHandler):
} }
csi = '\x1b[' csi = '\x1b['
reset = '\x1b[0m' reset = '\x1b[0m'
bold = "\x1b[1m"
disable_coloring = False disable_coloring = False
@property @property
@ -150,40 +151,43 @@ class ColorizingStreamHandler(logging.StreamHandler):
else: else:
prefix = "" prefix = ""
match = re.search(r"\[([A-Z ]+)\]", message) match = re.search(r"\[([A-Z ]+)\]", message) # log level
if match: if match:
level = match.group(1) level = match.group(1)
if message.startswith("\x1b[1m"): if message.startswith(self.bold):
message = message.replace("\x1b[1m", "") message = message.replace(self.bold, "")
reset = self.reset + "\x1b[1m" reset = self.reset + self.bold
params.append('1') params.append('1')
else: else:
reset = self.reset reset = self.reset
message = message.replace(level, ''.join((self.csi, ';'.join(params), 'm', level, reset)), 1) message = message.replace(level, ''.join((self.csi, ';'.join(params), 'm', level, reset)), 1)
else:
message = "%s%s" % (prefix, ''.join((self.csi, ';'.join(params), 'm', message, self.reset)))
match = re.search(r"\A\s*\[([\d:]+)\]", message) match = re.search(r"\A\s*\[([\d:]+)\]", message) # time
if match: if match:
time = match.group(1) time = match.group(1)
if not message.endswith(self.reset): if not message.endswith(self.reset):
reset = self.reset reset = self.reset
elif message.startswith("\x1b[1m"): # bold elif message.startswith(self.bold): # bold
reset = self.reset + "\x1b[1m" reset = self.reset + self.bold
else: else:
reset = self.reset reset = self.reset
message = message.replace(time, ''.join((self.csi, str(self.color_map["cyan"] + 30), 'm', time, reset)), 1) message = message.replace(time, ''.join((self.csi, str(self.color_map["cyan"] + 30), 'm', time, reset)), 1)
match = re.search(r"\[(#\d+)\]", message) match = re.search(r"\[(#\d+)\]", message) # counter
if match: if match:
counter = match.group(1) counter = match.group(1)
if not message.endswith(self.reset): if not message.endswith(self.reset):
reset = self.reset reset = self.reset
elif message.startswith("\x1b[1m"): # bold elif message.startswith(self.bold): # bold
reset = self.reset + "\x1b[1m" reset = self.reset + self.bold
else: else:
reset = self.reset reset = self.reset
message = message.replace(counter, ''.join((self.csi, str(self.color_map["yellow"] + 30), 'm', counter, reset)), 1) message = message.replace(counter, ''.join((self.csi, str(self.color_map["yellow"] + 30), 'm', counter, reset)), 1)
else:
message = ''.join((self.csi, ';'.join(params), 'm', message, self.reset))
if prefix:
message = "%s%s" % (prefix, message)
return message return message

View File

@ -48,7 +48,7 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
fcb74fcc9577523524659ec49e2e964b lib/core/session.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py
c4439324bd9484f4a35d648a20d7bf87 lib/core/settings.py 21189972adee4e784a2ffad146550749 lib/core/settings.py
dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
95f04c1c1d8c3998d86e1bdf0e12771c lib/core/target.py 95f04c1c1d8c3998d86e1bdf0e12771c lib/core/target.py
@ -285,7 +285,7 @@ fd1bff6caefe5007444f7a0fabbc8ce9 tamper/space2mysqlblank.py
929a2586dbb7b758a454eb09e13e5a73 tamper/versionedkeywords.py 929a2586dbb7b758a454eb09e13e5a73 tamper/versionedkeywords.py
3aff4d344ebd4f38e033e73b63f84447 tamper/versionedmorekeywords.py 3aff4d344ebd4f38e033e73b63f84447 tamper/versionedmorekeywords.py
ed1acafbac707bfa71c72f76b81c1bdd tamper/xforwardedfor.py ed1acafbac707bfa71c72f76b81c1bdd tamper/xforwardedfor.py
2350c4ab8a9972980ad93466066294e9 thirdparty/ansistrm/ansistrm.py 0424227a228a2b5b53ad1d6df4240ddd thirdparty/ansistrm/ansistrm.py
d41d8cd98f00b204e9800998ecf8427e thirdparty/ansistrm/__init__.py d41d8cd98f00b204e9800998ecf8427e thirdparty/ansistrm/__init__.py
8e775c25bc9e84891ad6fcb4f0005c23 thirdparty/beautifulsoup/beautifulsoup.py 8e775c25bc9e84891ad6fcb4f0005c23 thirdparty/beautifulsoup/beautifulsoup.py
cb2e1fe7c404dff41a2ae9132828f532 thirdparty/beautifulsoup/__init__.py cb2e1fe7c404dff41a2ae9132828f532 thirdparty/beautifulsoup/__init__.py