Search code examples
pythontcppacket

How to reassemble TCP packets in Python?


How to reassemble TCP packets in Python? Is there any existing tools for this?

Thanks! :-)


Solution

  • To do perform TCP reassembly you'll need to use something like pynids http://jon.oberheide.org/pynids/.

    You can also build your own using pylibpcap, dpkt or scapy.

    TCP reassembly is very tricky with a LOT of edge cases. I wouldn't recommend doing it yourself if you need a robust solution.