forked from showmehow/pypwn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirbuster.py
executable file
·51 lines (38 loc) · 985 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import urllib2
import sys
import os
print """
Directory Scanner v.0.1
Ken Eddy - files.eddy@gmail.com
"""
#if len(sys.argv) != 2:
# sys.stderr.write('Usage: '+sys.argv[0]+' URL DIRLIST\n\n')
# sys.exit(1)
#if os.path.exists(sys.argv[2]):
# sys.stderr.write('Wrong path of DIRLIST')
# sys.exit(1)
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 "[?] Unknwon"
print "\n:. FINISH :.\n"