Detect redirect from stdout

This commit is contained in:
Miroslav Stampar 2018-08-30 15:21:46 +02:00
parent 74d2b60cf3
commit 366a3f9336
3 changed files with 6 additions and 4 deletions

View File

@ -54,7 +54,7 @@ def get_page(get=None, url=None, host=None, data=None):
return result
def colorize(message):
if not subprocess.mswindows:
if not subprocess.mswindows and sys.stdout.isatty():
message = re.sub(r"\[(.)\]", lambda match: "[%s%s\033[00;49m]" % (LEVEL_COLORS[match.group(1)], match.group(1)), message)
message = message.replace("@sqlmap", "\033[00;96m@sqlmap\033[00;49m")
message = message.replace(NAME, "\033[00;93m%s\033[00;49m" % NAME)
@ -114,5 +114,7 @@ def main():
if not found:
print colorize("[o] nothing found")
print
if __name__ == "__main__":
main()

View File

@ -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.8.25"
VERSION = "1.2.8.26"
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)

View File

@ -22,7 +22,7 @@ e4805169a081b834ca51a60a150c7247 extra/shutils/newlines.py
1e5532ede194ac9c083891c2f02bca93 extra/sqlharvest/__init__.py
b3e60ea4e18a65c48515d04aab28ff68 extra/sqlharvest/sqlharvest.py
1e5532ede194ac9c083891c2f02bca93 extra/wafdetectify/__init__.py
85ca5478dc2bd9db40772e52dad2f84a extra/wafdetectify/wafdetectify.py
5a5d4305e9dd22c3ba06b8587dad9db7 extra/wafdetectify/wafdetectify.py
3459c562a6abb9b4bdcc36925f751f3e lib/controller/action.py
7493c782345a60f6c00c9281d51a494e lib/controller/checks.py
c414cecdb0472c92cf50ed5b01e4438c lib/controller/controller.py
@ -50,7 +50,7 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
13758369fddb4d7e791e989966908ee6 lib/core/settings.py
d30a78044622a9f97a2b62eec4c62e95 lib/core/settings.py
dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
815d1cf27f0f8738d81531e73149867d lib/core/target.py