From 0703843c4eb37f64c081fc36bd85f94fbfa504b8 Mon Sep 17 00:00:00 2001 From: Tanaydin Sirin Date: Fri, 5 Apr 2019 15:11:57 +0200 Subject: [PATCH] Better output for file. --- detection.py | 5 ++++- functions.py | 15 ++++++++------- index.py | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/detection.py b/detection.py index 2a2e872..eb28031 100644 --- a/detection.py +++ b/detection.py @@ -91,9 +91,12 @@ def analysis(path,plain): # Run thru every files and subdirectories def recursive(dir,progress,plain): progress += 1 + progress_indicator = '⬛' + if plain: progress_indicator = "█" try: for name in os.listdir(dir): - print('\tAnalyzing : '+'⬛'*progress+'\r'), + + print('\tAnalyzing : '+ progress_indicator * progress+'\r'), # Targetting only PHP Files if os.path.isfile(os.path.join(dir, name)): diff --git a/functions.py b/functions.py index 4813076..fc18759 100644 --- a/functions.py +++ b/functions.py @@ -19,13 +19,13 @@ def nth_replace(string, old, new, n): # Display the found vulnerability with basic informations like the line def display(path,payload,vulnerability,line,declaration_text,declaration_line, colored, occurence, plain): # Potential vulnerability found : SQL Injection - header = "\033[{}mPotential vulnerability found : \033[{}m{}\033[0m".format('0' if plain else '1', '0' if plain else '92', payload[1]) + header = "{}Potential vulnerability found : {}{}{}".format('' if plain else '\033[1m', '' if plain else '\033[92m', payload[1], '' if plain else '\033[0m') # Line 25 in test/sqli.php - line = "n°\033[{}m{}\033[0m in {}".format('0' if plain else '92',line,path) + line = "n°{}{}{} in {}".format('' if plain else '\033[92m',line, '' if plain else '\033[0m', path) # Code : include($_GET['patisserie']) - vuln = nth_replace("".join(vulnerability), colored, "\033[{}m".format('0' if plain else '92')+colored+"\033[0m", occurence) + vuln = nth_replace("".join(vulnerability), colored, "{}".format('' if plain else '\033[92m')+colored+"{}".format('' if plain else '\033[0m'), occurence) vuln = "{}({})".format(payload[0], vuln) # Final Display @@ -33,16 +33,17 @@ def display(path,payload,vulnerability,line,declaration_text,declaration_line, c print "-" * (int(columns)-1) print "Name \t{}".format(header) print "-" * (int(columns)-1) - print "\033[{}mLine \033[0m {}".format('0' if plain else '1', line) - print "\033[{}mCode \033[0m {}".format('0' if plain else '1', vuln) + print "{}Line {} {}".format('' if plain else '\033[1m', '' if plain else '\033[0m', line) + print "{}Code {} {}".format('' if plain else '\033[1m', '' if plain else '\033[0m', vuln) # Declared at line 1 : $dest = $_GET['who']; if not "$_" in colored: declared = "Undeclared in the file" if declaration_text != "": - declared = "Line n°\033[0;{}m{}\033[0m : {}".format('0' if plain else '92', declaration_line, declaration_text) + declared = "Line n°{}{}{} : {}".format('' if plain else '\033[0;92m', declaration_line, '' if plain else '\033[0m', declaration_text) + #declared = "Line n°\033[0;{}m{}\033[0m : {}".format('0' if plain else '92', declaration_line, declaration_text) - print "\033[{}mDeclaration \033[0m {}".format('0' if plain else '1', declared) + print "{}Declaration {} {}".format('' if plain else '\033[1m', '' if plain else '\033[0m', declared) # Small delimiter print "" diff --git a/index.py b/index.py index d171b7b..6786909 100644 --- a/index.py +++ b/index.py @@ -29,7 +29,7 @@ if __name__ == "__main__": print "\-'\ / \ '-'(_ .' | |'| | \ | `-/ /` (_' '--'\ ' '-' '| '-' / | `---." print " `-' `-----' `-----' `--' `--' `--' `-----' `-----' `------' `------'" print " Copyright @pentest_swissky " - print ("\n\033[{}mAnalyzing '{}' source code\033[{}m".format('0' if results.plain else '1', results.dir, '0')) + print ("\n{}Analyzing '{}' source code{}".format('' if results.plain else '\033[1m', results.dir, '' if results.plain else '\033[0m')) if os.path.isfile(results.dir): analysis(results.dirm, results.plain)