Commits

Tim Tomes committed d5e56b1 Merge

Merged in WebBreacher/peepingtom (pull request #4)

Added verbose flag

  • Participants
  • Parent commits a68e7aa, 654bca6

Comments (0)

Files changed (1)

     parser.add_option('-x', help='xml input mode. path to Nessus/Nmap XML file.', dest='xml_file', type='string', action='store')
     parser.add_option('-s', help='single input mode. path to target, remote URL or local path.', dest='target', type='string', action='store')
     parser.add_option('-t', help='socket timeout in seconds. default is 8 seconds.', dest='timeout', type='int', action='store')
+    parser.add_option('-v', help='verbose mode', dest='verbose', action='store_true', default=False)
     (opts, args) = parser.parse_args()
 
     # process options
     db = {'targets': []}
     cnt = 0
     tot = len(targets) * 2
+    previouslen = 0
     try:
         for target in targets:
-            #print '[*] %s' % (target)
-            printProgress(cnt, tot)
+            # Displays the target name to the right of the progress bar
+            if opts.verbose:
+                printProgress(cnt, tot, target, previouslen)
+            else:
+                printProgress(cnt, tot)
             filename = '%s.png' % re.sub('\W','',target)
             filepath = '%s/%s' % (directory, filename)
             getCapture(target, filepath, timeout)
             cnt += 1
-            printProgress(cnt, tot)
+            previouslen = len(target)
             target_data = {}
             target_data['url'] = target
             target_data['path'] = filename
     if stderr: response += str(stderr)
     return proc.returncode, response.strip()
 
-def printProgress(cnt, tot):
+def printProgress(cnt, tot, target='', previouslen=0):
     percent = 100 * float(cnt) / float(tot)
-    sys.stdout.write('[%-40s] %d%%\r' % ('='*int(float(percent)/100*40), percent))
+    if target and previouslen > len(target): 
+        target = target + ' ' * (previouslen - len(target))
+    sys.stdout.write('[%-40s] %d%%   %s\r' % ('='*int(float(percent)/100*40), percent, target))
     sys.stdout.flush()
     return ''