Tim Tomes avatar Tim Tomes committed f4713b5 Merge

Merged in ethanr/peepingtom-dev (pull request #5)

Adding features to help support scripting

Comments (0)

Files changed (1)

 import time
 import os
 import hashlib
+import random
 
 #=================================================
 # MAIN FUNCTION
     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)
+    parser.add_option('-b', help='open results in browser', dest='browser', action='store_true', default=False)
     (opts, args) = parser.parse_args()
 
     # process options
     print '[*] Analyzing %d targets.' % (len(targets))
 
     # setup data storage location
-    directory = time.strftime('%y%m%d_%H%M%S', time.localtime())
+    random.seed()
+    directory = time.strftime('%y%m%d_%H%M%S', time.localtime()) + '_%04d' % random.randint(1, 10000)
     print '[*] Storing data in \'%s/\'' % (directory)
     os.mkdir(directory)
     report = 'peepingtom.html'
     
     # build the report and exit
     buildReport(db, outfile)
-    import webbrowser
-    path = os.getcwd()
-    w = webbrowser.get()
-    w.open('file://%s/%s/%s' % (path, directory, report))
+    if opts.browser:
+        import webbrowser
+        path = os.getcwd()
+        w = webbrowser.get()
+        w.open('file://%s/%s/%s' % (path, directory, report))
     print '[*] Done.'
 
 #=================================================
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.