-
Notifications
You must be signed in to change notification settings - Fork 26
/
dirbuster.py
32 lines (30 loc) · 896 Bytes
/
dirbuster.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
#!/usr/bin/env python
# A dirbuster clone in python
# https://github.com/ahhh/SPSE
import urllib2
import sys
import os
url = sys.argv[1]
open_dir_list = open("dirlist.txt", 'r')
dirs = open_dir_list.read().split("\n")
open_dir_list.close()
for dir in dirs:
uri = url+"/"+dir
try:
response = urllib2.urlopen(uri)
if response:
print response.info()
if response.getcode() == 200:
print "[+] FOUND %s " % (uri)
except urllib2.HTTPError, e:
if e.code == 401:
print "[!] Authorization Required %s " % (uri)
elif e.code == 403:
print "[!] Forbidden %s " % (uri)
elif e.code == 404:
print "[-] Not Found %s " % (uri)
elif e.code == 503:
print "[!] Service Unavailable %s " % (uri)
else:
print "[?] Unknown"
print "\n.:. FINISH .:.\n"