我有很多pcap
个文件
在每个pcap文件中都有一些tcp包
我想要以下步骤:
1过滤pcap文件以获得预期的tcp数据包(如果使用tshark,则过滤器类似于tcp.srcport==80 and 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
每个tcp数据包 2,我想得到4)
最重要的是,我只想从每个tcp数据包中获取一对IP,很容易从tshark获取源IP,但是tcp数据中的IP地址需要一些努力
是否有任何好的源代码片段或可用于我的目标的好方法? 谢谢!