forked from lemonlove7/dirsearch_bypass403
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirsearch.py
205 lines (164 loc) · 6.18 KB
/
dirsearch.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/usr/bin/env python3
#
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# Author: Mauro Soria
import time
from colorama import init, Fore, Style
from lib.pass403 import Arguments,Program
from lib.qc import pass403_qc
import threading
from concurrent.futures import ThreadPoolExecutor
import queue
import sys,os
from pkg_resources import DistributionNotFound, VersionConflict
from lib.core.data import options
from lib.core.exceptions import FailedDependenciesInstallation
from lib.core.installation import check_dependencies, install_dependencies
from lib.core.settings import OPTIONS_FILE
from lib.parse.config import ConfigParser
init()
if sys.version_info < (3, 7):
sys.stdout.write("Sorry, dirsearch requires Python 3.7 or higher\n")
sys.exit(1)
config = ConfigParser()
config.read(OPTIONS_FILE)
if config.safe_getboolean("options", "check-dependencies", False):
try:
check_dependencies()
except (DistributionNotFound, VersionConflict):
option = input("Missing required dependencies to run.\n"
"Do you want dirsearch to automatically install them? [Y/n] ")
if option.lower() == 'y':
print("Installing required dependencies...")
try:
install_dependencies()
except FailedDependenciesInstallation:
print("Failed to install dirsearch dependencies, try doing it manually.")
exit(1)
else:
config.set("options", "check-dependencies", "False")
with open(OPTIONS_FILE, "w") as fh:
config.write(fh)
##
def bypass():
with open('bypass403_url.txt') as f:
bypass403_url=f.read()
while not q.empty():
path_403=q.get()
try:
argument = Arguments(bypass403_url, None, path_403, None)
program = Program(argument.return_urls(), argument.return_dirs())
program.initialise()
except:
pass
def run_bypass403():
size = os.path.getsize('403list.txt')
size_js=os.path.getsize('jsfind403list.txt')
from lib.core.options import parse_options
if (parse_options()['bypass']) == None:
pass
else:
bp403="".join(parse_options()['bypass'])
if bp403 =='yes':
if size ==0 and size_js ==0:
print(Fore.GREEN + Style.BRIGHT + 'No 403 status code present!'+Style.RESET_ALL)
else:
print(Fore.GREEN + Style.BRIGHT+'Start 403bypass!'+Style.RESET_ALL)
with open('403list.txt',) as f1:
list_403=f1.readlines()
for path_403 in list_403:
path_403=path_403.replace('\n','').replace('\r','')
q.put(path_403)
thread_list = []
for i in range(20):
t = threading.Thread(target=bypass)
thread_list.append(t)
for t in thread_list:
t.setDaemon(True)
t.start()
for t in thread_list:
t.join()
if size_js == 0:
pass
else:
try:
with open('jsfind403list.txt') as js1:
jsf=js1.readlines()
def process_ff(ff):
ff = ff.replace('\n', '').replace('\r', '')
num_slashes = ff.count('/')
if num_slashes == 2:
ff = ff + '/'
split_url = ff.split("/")
js_url = "/".join(split_url[:3])
js_path = split_url[3]
if js_path == '':
js_path = '/'
argument = Arguments(js_url, None, js_path, None)
program = Program(argument.return_urls(), argument.return_dirs())
program.initialise()
def js_403():
with ThreadPoolExecutor() as executor:
executor.map(process_ff, jsf)
js_403()
except:
pass
pass403_qc()
else:
pass
def jsfind():
import lib.JSFinder
from lib.core.options import parse_options
if (parse_options()['jsfind']) == None:
pass
else:
jsf="".join(parse_options()['jsfind'])
if jsf=='yes':
print(Fore.GREEN + Style.BRIGHT+"Start JsFind!"+Style.RESET_ALL)
url="".join(parse_options()['urls'])
urls = lib.JSFinder.find_by_url(url)
lib.JSFinder.giveresult(urls, url)
else:
pass
def ehole():
import ehole.ehole
from lib.core.options import parse_options
if (parse_options()['zwsb']) == None:
pass
else:
zwsb="".join(parse_options()['zwsb'])
if zwsb=='yes':
print(Fore.GREEN + Style.BRIGHT + "fingerprint identification!" + Style.RESET_ALL)
ehole.ehole.start_ehole()
else:
pass
def hhh():
open("403list.txt", 'w').close()
open('jsfind403list.txt','w').close()
def main():
hhh()
from lib.core.options import parse_options
options.update(parse_options())
from lib.controller.controller import Controller
Controller()
jsfind()
run_bypass403()
ehole()
if __name__ == "__main__":
q = queue.Queue()
main()