-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
110 lines (93 loc) · 3 KB
/
app.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import requests
from os.path import join
file_type_dict = {
'1': 'dir_',
'2': 'file_',
'3': 'file_php_',
'4': '(dir-file) '
}
word_type_dict = {
'1': 'all',
'2': 'common',
'3': 'crazy',
'4': 'extra'
}
def get_ans(qs):
while True:
ans = input(qs)
if ans.lower() == 'y':
return True
elif ans.lower() == 'n':
return False
def request(url):
try:
r = requests.get(url)
if r.status_code == 404:
return False
else:
return r.status_code
except Exception as e:
print('\n[!] - OOps. Got error.\n')
print(e, '\n')
return None
if __name__ == '__main__':
print('')
print('\t++++++++++++++++++++++++++++++++++++')
print('\t||| Web Directories Discoverer |||')
print('\t||| By @codernayeem |||')
print('\t====================================')
while True:
count = 0
save = ''
print('\n[+] - Enter Target link')
target = input('[?] --> ')
if target == '':
continue
if not (target.startswith('http://') or target.startswith('https://')):
target = 'http://' + target
if not target.endswith('/'):
target += '/'
print('\n---> Let\'s use buitin dictionaries! ')
while True:
print('\n--> Choose dictionary type? ')
print(' 1. Only Directory')
print(' 2. Only Files')
print(' 3. Only Files (PHP)')
print(' 4. Directory & Files')
ans = input('[>] ')
if ans in ['1', '2', '3', '4']:
file_type = ans
break
while True:
print('\n--> Choose words type? ')
print(' 1. All')
print(' 2. Common')
print(' 3. Crazy')
print(' 4. Extra')
ans = input('[>] ')
if ans in ['1', '2', '3', '4']:
word_type = ans
break
file_path = join('wordlist', file_type_dict[file_type] + word_type_dict[word_type] + '.wordlist')
try:
fl = open(file_path, 'r')
except:
print(f'[+] - Failed to open "{file_path}". Make sure that file exists.\n')
continue
directory_list = fl.read().strip().splitlines()
fl.close()
print('[+] - Searching started ...\n')
for a_item in directory_list:
a_item = a_item.strip()
if a_item != '':
link = target + a_item
response = request(link)
if response is None:
print('[+] - Got error. So we sttoped.')
break
elif response:
print(f'\n[+] - Got at - {link} - [{response}]')
count += 1
print(f'\n[!] - All done ({count})')
if not get_ans('\n[?] - Wanna try again? '):
exit(0)