Networking 分析“pcap”文件中每个tcp数据包的tcp负载

Networking 分析“pcap”文件中每个tcp数据包的tcp负载,networking,pcap,libpcap,tcpdump,Networking,Pcap,Libpcap,Tcpdump,我有很多pcap文件 在每个pcap文件中都有一些tcp数据包 我希望执行以下步骤: 1过滤pcap文件以获得预期的tcp数据包(如果使用tshark,则过滤器类似于tcp.srcport==80和tcp.dstport==20000)。每个tcp数据包中的tcp数据为数十字节 1) the first 2 bytes are sequence number 2) the second 2 bytes indicate a length: **n** 3) the following

我有很多
pcap
文件 在每个pcap文件中都有一些tcp数据包 我希望执行以下步骤:

1过滤pcap文件以获得预期的tcp数据包(如果使用tshark,则过滤器类似于
tcp.srcport==80和tcp.dstport==20000
)。每个tcp数据包中的tcp数据为数十字节

  1) the first 2 bytes are sequence number
  2) the second 2 bytes indicate a length: **n**
  3) the following **n** bytes are random (if **n** is 2, then there are 2 random bytes)
  4) immediately after the **n** bytes is an IP address
2从每个tcp数据包中,我想获得源IP和IP地址字符串,如
4)

首先,我只想从每个tcp数据包中获得一个IP对,源IP很容易从tshark获得,但是tcp数据中的IP地址需要一些努力

有什么好的源代码片段或好的方法可以用于我的目标吗? 谢谢