def p2p_upload(fn): #upload files if fn not in filestore: # For only signed files print(Fore.RED + "[-] File does not exist\n" + Style.RESET_ALL) return sconn = find_bot() sconn.send(bytes("FILE", "utf-8")) p2p_upload_file(sconn, fn)
def p2p_echo(): try: sconn = find_bot() # Set verbose to true so we can view the encoded packets sconn.verbose = True sconn.send(bytes("ECHO", "ascii")) while 1: # Read a message and send it to the other bot msg = input("Echo> ") byte_msg = bytes(msg, "ascii") sconn.send(byte_msg) # This other bot should echo it back to us echo = sconn.recv() # Ensure that what we sent is what we got back assert(echo == byte_msg) # replay attack test # if echo == "replay attack": # If the msg is X, then terminate the connection if msg.lower() == 'x' or msg.lower() == "exit" or msg.lower() == "quit": sconn.close() break except socket.error: print("Connection closed unexpectedly")
def p2p_upload(fn): # Check if the file exists before sending empty if fn not in filestore: print("That file doesn't exist in the botnet's filestore") return sconn = find_bot() sconn.send(bytes("FILE", "ascii")) p2p_upload_file(sconn, fn)
def p2p_echo(): #find other bots listening on the network try: sconn = find_bot() sconn.send(bytes("ECHO", "utf-8")) while True: msg = input("[+] Message> ") byte_msg = bytes(msg, "utf-8") sconn.send(byte_msg) echo = sconn.recv() assert (echo == byte_msg) if msg.lower() == "exit" or msg.lower() == "quit": sconn.close() break except socket.error: print(Fore.CYAN + "[-] Connection closed unexpectedly\n" + Style.RESET_ALL)
def p2p_echo(): try: sconn = find_bot() # Set verbose to true so we can view the encoded packets sconn.verbose = True sconn.send(bytes("ECHO", "ascii")) while 1: # Read a message and send it to the other bot msg = input("Echo> ") byte_msg = bytes(msg, "ascii") sconn.send(byte_msg) # This other bot should echo it back to us echo = sconn.recv() # Ensure that what we sent is what we got back assert(echo == byte_msg) # If the msg is X, then terminate the connection if msg.lower() == 'x' or msg.lower() == "exit" or msg.lower() == "quit": sconn.close() break except socket.error: print("Connection closed unexpectedly")
def p2p_echo(): try: sconn = find_bot() # Set verbose to true so we can view the encoded packets sconn.verbose = True sconn.verbose2 = False sconn.send(bytes("ECHO", "ascii")) while 1: # Client receive nonce from server sconn.recv() # Read a message and send it to the other bot msg = input("Echo> ") sconn.verbose2 = True byte_msg = bytes(msg, "ascii") sconn.send(byte_msg) # This other bot should echo it back to us echo = sconn.recv() # If the msg is x or exit or quit, then terminate the connection if byte_msg == b'x' or msg.lower() == "exit" or msg.lower( ) == "quit": sconn.close() break except socket.error: print("Connection closed unexpectedly")
def p2p_upload(fn): sconn = find_bot() sconn.send(bytes("FILE", "ascii")) p2p_upload_file(sconn, fn)
def p2p_upload(fn): sconn = find_bot() #sconn.verbose=True sconn.send(bytes("FILE", "ascii")) p2p_upload_file(sconn, fn)
def p2p_upload(fn): sconn = find_bot() #sconn.verbose=True sconn.send(bytes("FILE", "ascii")) p2p_upload_file(sconn,fn)