Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import socket
  2.  
  3. HOST             = ''
  4. PORT             = 3333
  5. bytes_to_receive = 1024
  6.  
  7. connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  8. connection.bind((HOST, PORT))
  9. connection.listen(5)
  10.  
  11. while 1:
  12.     server = connection.accept()
  13.     server.recv(bytes_to_receive)
  14.  
  15.     username = server.send(raw_input("Enter username: "))
  16.     password = server.send(raw_input("Enter password: "))
  17.  
  18.     if username == 'xPl0it' and password == 'scar':
  19.         server.send("Login successful!")
  20.         command = server.send(raw_input("Awaiting command: "))
  21.         if command == 'retrieve':
  22.             file_handling = open('SCAR.txt', 'r')
  23.             server.send(file_handling.read())
  24.  
  25.         elif command == 'exit':
  26.             connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement