Skip to content

Commit 7857601

Browse files
committed
Fixed a threading issue, shuffled main()
1 parent 0f11ba0 commit 7857601

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

start.py

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,18 @@ def do_GET(self):
9292
self.send_error(404)
9393

9494
if path == 'rop.js':
95-
print('>> Exploit Sent...')
96-
thread = threading.Thread(target=payload_brain,
97-
args=(self.client_address[0],))
98-
thread.daemon = True
99-
thread.start()
95+
payload_menu = True
96+
for thread in threading.enumerate():
97+
if thread.name == 'payload_brain':
98+
payload_menu = False
99+
100+
if payload_menu:
101+
print('>> Exploit Sent...')
102+
thread = threading.Thread(name='payload_brain',
103+
target=payload_brain,
104+
args=(self.client_address[0],),
105+
daemon=True)
106+
thread.start()
100107

101108

102109
def check_root():
@@ -249,8 +256,9 @@ def start_servers():
249256

250257
print('>> Starting HTTP server thread...')
251258
server = ThreadedHTTPServer(('', 80), MyHandler)
252-
thread = threading.Thread(target=server.serve_forever, args=())
253-
thread.daemon = True
259+
thread = threading.Thread(target=server.serve_forever,
260+
args=(),
261+
daemon=True)
254262
thread.start()
255263
clear_line()
256264
print('>> HTTP server thread is running...')
@@ -396,32 +404,32 @@ def main():
396404
required=False, help='Print debug statements')
397405
args = parser.parse_args()
398406

399-
if not args.e_type:
400-
args.e_type = exploit_menu()
407+
try:
408+
if args.debug:
409+
DEBUG = True
410+
else:
411+
DEBUG = False
412+
MyHandler.log_message = silence_http
401413

402-
if os.path.isdir(os.path.join(EXPLOIT_LOC, args.e_type)) and args.e_type:
403-
EXPLOIT_LOC = os.path.join(EXPLOIT_LOC, args.e_type)
404-
else:
405-
closer('ERROR: Could not find exploit specified')
414+
check_update_pups()
406415

407-
if args.debug:
408-
DEBUG = True
409-
else:
410-
DEBUG = False
411-
MyHandler.log_message = silence_http
416+
if not args.e_type:
417+
args.e_type = exploit_menu()
412418

413-
check_update_pups()
419+
if os.path.isdir(os.path.join(EXPLOIT_LOC, args.e_type)) and args.e_type:
420+
EXPLOIT_LOC = os.path.join(EXPLOIT_LOC, args.e_type)
421+
else:
422+
closer('ERROR: Could not find exploit specified')
414423

415-
lan = get_lan()
424+
lan = get_lan()
416425

417-
if write_conf(lan):
418-
print('>> Your DNS IP is {}'.format(lan))
419-
else:
420-
closer('ERROR: Unable to write {}'.format(DNS_LOC))
426+
if write_conf(lan):
427+
print('>> Your DNS IP is {}'.format(lan))
428+
else:
429+
closer('ERROR: Unable to write {}'.format(DNS_LOC))
421430

422-
start_servers()
431+
start_servers()
423432

424-
try:
425433
while True:
426434
pass
427435
except KeyboardInterrupt:

0 commit comments

Comments
 (0)