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()