def accept_connection(conn): try: sconn = StealthConn(conn, server=True) # The sender is either going to chat to us or send a file cmd, flag = sconn.recv() if cmd == b'ECHO': echo_server(sconn) elif cmd == b'FILE': p2p_download_file(sconn) except socket.error: print("Connection closed unexpectedly")
def accept_connection(conn): try: sconn = StealthConn(conn, server=True) # The sender is either going to chat to us or send a file cmd = sconn.recv() if cmd == b'ECHO': echo_server(sconn) elif cmd == b'FILE': p2p_download_file(sconn) except socket.error: print("Connection closed unexpectedly")
def accept_connection(conn): try: sconn = StealthConn(conn, server=True) cmd = sconn.recv() if cmd == b'ECHO': #Echo echo_server(sconn) elif cmd == b'FILE': #File download p2p_download_file(sconn) except socket.error: print(Fore.CYAN + "[-] Connection closed unexpectedly\n" + Style.RESET_ALL) #Something went wrong
def accept_connection(conn): try: sconn = StealthConn(conn, server=True) # The sender is either going to chat to us or send a file cmd = sconn.recv() if cmd == b'ECHO': echo_server(sconn) elif cmd == b'FILE': p2p_download_file(sconn) else: raise RuntimeError("Invalid command: {}".format(cmd)) except socket.error: print("Connection closed unexpectedly")
def accept_connection(conn): try: sconn = StealthConn(conn, rsa_key, server=True) # The sender is either going to chat to us or send a file cmd = sconn.recv() if cmd == b'ECHO': echo_server(sconn) elif cmd == b'FILE': p2p_download_file(sconn) except socket.error: print("Connection closed unexpectedly") except RuntimeError: traceback.print_exc() print("Authentication Failed")
def accept_connection(conn): try: f = open("serverPublic.pem", 'r') rsaKey = RSA.importKey(f.read()) f.close() sconn = StealthConn(conn, rsaKey, server=True) # The sender is either going to chat to us or send a file cmd = sconn.recv() if cmd == b'ECHO': echo_server(sconn) elif cmd == b'FILE': p2p_download_file(sconn) except socket.error: print("Connection closed unexpectedly") except RuntimeError: traceback.print_exc() print("Authentication Failed")