Parsing back together TCP Packets

asked 2020-02-02 18:06:36 +0000

I am working on a tool that takes a pcap file, and attempts to parse out data from the TCP packets.

Now in this case, I only care about the data in one direction. So my logic was to sort out each wireshark captured packet into a list by the protocol-destIP-sourceIP-destPort-sorcePort.

So from this point, I now have a list of only packets for one direction on a particular port.

From there I just want to be able to walk through the bodies of the TCP payloads in order. is it as simple as then going in order by Sequence numbers?

I would simply take the first sequence number captured, add the payload size to it and expect that to be the next TCP packet sent? Is there more to this that I am missing?

I was noticing when sorting the interfaces this way, eventually I would come up to a sequence that dosent make sense. I guess I could just assume that is the start of the next stream? I know it becomes more difficult if I have to consider traffic going back and forth... but in this case I only want to watch packets in one direction.

edit retag flag offensive close merge delete


I hear that there's an excellent tool called tshark that seems to do what you want :-)

grahamb gravatar imagegrahamb ( 2020-02-03 13:26:11 +0000 )edit