Advertisement
BornePlays

Server

Jun 3rd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. import socket, base64, time, sys
  3.  
  4. print('[*] Server Started!')
  5. time.sleep(1)
  6. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  7. s.bind(('192.168.56.1', 442))
  8. s.listen(2)
  9. print('[*] Listening for incoming connections!')
  10. time.sleep(1)
  11. (client, (ip, port)) = s.accept()
  12. print('[*] Received Connection: ' + ip)
  13.  
  14. while True:
  15. command = raw_input('command: ')
  16. if command == 'quit':
  17. s.close()
  18. sys.exit()
  19. encode = base64.encodestring(command)
  20. client.send(bytes(encode))
  21. en_data = client.recv(2048)
  22. decode = base64.decodestring(en_data)
  23. print decode
  24.  
  25. print '[*] Closing Connection'
  26. time.sleep(3)
  27. client.close()
  28. s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement