Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 108 by
sm...@depht.com: Setting TCP offset truncates TCP data
field
http://code.google.com/p/dpkt/issues/detail?id=108
-What steps will reproduce the problem?
import sys
import pcap
import ethernet
import tcp
if(len(sys.argv) > 2):
pcIn = pcap.Reader(open(sys.argv[1]))
pcOut = pcap.Writer(open(sys.argv[2], 'wb'))
for ts, pkt in pcIn:
eth = ethernet.Ethernet(pkt)
ip = eth.data
otcp = ip.data
newTCP = tcp.TCP()
newTCP.dport = otcp.dport
newTCP.sport = otcp.sport
newTCP.win = otcp.win
newTCP.off = otcp.off
# newTCP.off_x2 = otcp.off_x2
newTCP.sum = otcp.sum
newTCP.flags = otcp.flags
newTCP.seq = otcp.seq
newTCP.ack = otcp.ack
newTCP.data = otcp.data
ip.data = newTCP
pcOut.writepkt(ethernet.Ethernet.pack(eth), ts)
-What is the expected output? What do you see instead?
I expect the above script will copy the TCP packets exactly.
-What version of the product are you using? On what operating system?
dpkt-1.7r88
Debian Linux Wheezy(7.0)
Python 2.7.3
-Please provide any additional information below.
Example source and corupted destination pcap files are attached.
It's quite possible I am simply not doing this correctly. If so please
tell me the correct way to calculate the TCP data offset.
Thanks,
Smutt
Attachments:
source.pcap 722 bytes
corrupt.pcap 674 bytes
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings