forked from wirasecure/pentest-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirbust.py
executable file
·38 lines (32 loc) · 984 Bytes
/
dirbust.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
import sys
import os
import subprocess
if len(sys.argv) != 3:
print "Usage: dirbust.py <target url> <scan name>"
sys.exit(0)
url = str(sys.argv[1])
name = str(sys.argv[2])
folders = ["/usr/share/dirb/wordlists", "/usr/share/dirb/wordlists/vulns"]
found = []
print "INFO: Starting dirb scan for " + url
for folder in folders:
for filename in os.listdir(folder):
outfile = " -o " + "results/exam/" + name + "_dirb_" + filename
DIRBSCAN = "dirb %s %s/%s %s -S -r" % (url, folder, filename, outfile)
try:
results = subprocess.check_output(DIRBSCAN, shell=True)
resultarr = results.split("\n")
for line in resultarr:
if "+" in line:
if line not in found:
found.append(line)
except:
pass
try:
if found[0] != "":
print "[*] Dirb found the following items..."
for item in found:
print " " + item
except:
print "INFO: No items found during dirb scan of " + url