From 62293a00ef439c2f76ad217bd823a76e173f0473 Mon Sep 17 00:00:00 2001 From: Marc Jones Date: Wed, 26 Feb 2014 14:14:08 -0500 Subject: updated output of progress to limit screen wrapping --- suspicious | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/suspicious b/suspicious index 1a748eb..2b65105 100755 --- a/suspicious +++ b/suspicious @@ -1,7 +1,7 @@ #!/usr/bin/python #Author: Marc Jones #Date: Feb 26, 2014 -#Version .1 +#Version 0.1.1 from optparse import OptionParser @@ -130,7 +130,7 @@ def optimizewordlist(wordlist, maxwholewordlength): usage = "%prog [options] DIRECTORY ... DIRECTORYN" -epilog = "example: ./main.py ../git.lf/janitor -s .ppt -s .docx -s .pdf -s .xls -s .xlsx -s .gif -s .png -s .jpg -s .css -r fw -w cryptology.txt -c -p -l 3" +epilog = "example: ./suspicious ../git.lf/janitor -s .tar -s .gz -s .bmp -s .zip -s .ppt -s .docx -s .pdf -s .xls -s .xlsx -s .gif -s .png -s .jpg -s .css -r fw -w cryptology.txt -c -p -l 3" parser = OptionParser(usage = usage, epilog = epilog) parser.add_option("-f", "--file", dest="suspiciousfilename", help="specify file to scan", action="append") parser.add_option("-w", "--wordlist", dest="wordlistfilename", help="file containing all of the words to look for") @@ -223,8 +223,12 @@ for file in filelist: now = datetime.datetime.now() estimate = (((now - start) / (opened + skipped)) * len(filelist)) if options.display_progress: + if len(file)> 60: + prog_file = file.split('/')[0] + "..." + file.split('/')[-1] + else: + prog_file = file print '\r' + " " * len(progresstext) + '\r', - progresstext = str(((opened + skipped)*1.0/len(filelist))*100)[:5] + '% '+ " time left:" + str(estimate).split('.')[0] + ' ' + file + '\r' + progresstext = str(((opened + skipped)*1.0/len(filelist))*100)[:5] + '% '+ " time left:" + str(estimate).split('.')[0] + ' ' + prog_file + '\r' print progresstext, sys.stdout.flush() filecontents = f.read() -- cgit v1.2.1