diff --git a/week02/easy/client.py b/week02/easy/client.py index 9fd2922..58924dd 100644 --- a/week02/easy/client.py +++ b/week02/easy/client.py @@ -14,8 +14,8 @@ from random import randrange log = logging.getLogger(__name__) TCP_CLIENTS = {} # ((IP, port) -> [sent_packets]) -SERVER_IP = '131.159.15.68' # don't use the domain name in this case -# SERVER_IP = '192.168.1.4' # don't use the domain name in this case +# SERVER_IP = '131.159.15.68' # don't use the domain name in this case +SERVER_IP = '192.168.1.4' # don't use the domain name in this case SERVER_PORT = 20102 COOKIE_SECRET = 'TASTY_COOKIES123' INITIAL_SEQ = 1337 @@ -38,6 +38,7 @@ def handle_packet(packet: Packet): print("received acknowledgement") payload = bytes(packet[TCP].payload).decode(errors='ignore') print("Extracted flag:", payload) # This should print "hello world" + exit() # Function to start the packet sniffing diff --git a/week02/easy/server.py b/week02/easy/server.py index 784f686..b9ab53d 100644 --- a/week02/easy/server.py +++ b/week02/easy/server.py @@ -73,14 +73,13 @@ def handle_packet(packet: Packet): send(initial_syn) else: - print("i am in this state") if (0x02 in packet[TCP].flags) or (not seq == expected_cookie) or (not ack == INITIAL_SEQ): print(f'Invalid cookie {seq}, expected {expected_cookie}') rst = get_rst(src_ip, src_port, seq) send(rst) else: print(f'Cookie {expected_cookie} and packet is again correct') - + flag = "hello world" ip = IP(dst=src_ip) syn_ack = TCP(