This commit is contained in:
2024-11-10 19:22:02 +09:00
parent ca0fd21d73
commit be44ad3718
2 changed files with 4 additions and 4 deletions

View File

@ -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(