Skip to content

Commit

Permalink
Fix TCP Handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorNelson committed Feb 28, 2025
1 parent a121920 commit f5db8a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions intercepting-communication/level-11/run
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ class RawPacketHost(Host):
self.seq = random.randrange(0, 2**32)
response_packet = (scapy.IP(src=packet["IP"].dst, dst=packet["IP"].src) /
scapy.TCP(sport=packet["TCP"].dport, dport=packet["TCP"].sport,
seq=self.seq, ack=(packet["TCP"].seq + 1) & (2**32 - 1),
seq=self.seq, ack=(packet["TCP"].seq + 1) % (2**32),
flags="SA"))
scapy.send(response_packet, verbose=False)

if (packet["TCP"].seq == (31337 + 1) and packet["TCP"].ack == self.seq and
if (packet["TCP"].seq == (31337 + 1) and
packet["TCP"].ack == ((self.seq + 1) % (2**32)) and
packet["TCP"].flags == "A"):
print(flag, flush=True)

Expand Down

0 comments on commit f5db8a1

Please sign in to comment.