summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcrafted-pkt/make-tcp.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/crafted-pkt/make-tcp.py b/crafted-pkt/make-tcp.py
index 8f6bb00..508bbb3 100755
--- a/crafted-pkt/make-tcp.py
+++ b/crafted-pkt/make-tcp.py
@@ -12,20 +12,19 @@ def send(data, flags='A'):
seqno = last.seq + len(last.payload)
else:
seqno = 100
- tcp = TCP(sport=32323, dport=9, flags=flags, seq=seqno)/data
+ tcp = TCP(sport=32323, dport=80, flags=flags, seq=seqno)/data
pkt = IP(dst='10.0.0.2',src='10.0.0.1') / tcp
pkts.append(pkt)
return pkt
# data for one side
lines = [
- 'First\n',
- 'Second\n',
- 'Third\n',
- 'Fourth\n',
- 'Fifth\n',
- 'Sixth\n',
- 'Last\n'
+ 'PUT / HTTP/1.1\r\n', # 1
+ 'Content-Length: 6\r\n', # 2
+ '\r\n', # 3
+ '1\n', # 4
+ '2\n', # 5
+ '3\n', # 6
]
for line in lines:
send(line)
@@ -34,13 +33,12 @@ send('', flags='F') # FIN
# Errorneous packets
numbers = [
1,
- 1, # duplicate packet
+ 1, # Duplicate
2,
- 4, # out-of-order (2)
- 3, # out-of-order (1)
- 5,
- #6, # missing packet
- 7,
+ 3,
+ 5, # out-of-order
+ 4, # out-of-order
+ 6,
0, # FIN (last packet)
]