diff options
author | Marc Jones <mjones@softwarefreedom.org> | 2014-02-26 14:14:08 -0500 |
---|---|---|
committer | Marc Jones <mjones@softwarefreedom.org> | 2014-02-26 14:14:08 -0500 |
commit | 62293a00ef439c2f76ad217bd823a76e173f0473 (patch) | |
tree | c24afe60c3a1377f50e28bf056f526f55ff7ccda | |
parent | 35baac5f208ea129f51834deaa13e880ca2a74a7 (diff) |
updated output of progress to limit screen wrapping
-rwxr-xr-x | suspicious | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/python #Author: Marc Jones <mjones@softwarefreedom.org> #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() |