我正在用scapy接收ICMP Destination unreachable(Fragmentation needed ICMP TYPE=3 CODE=4)消息时进行TCP重新传输行为测试。在
测试流程如下:
1建立到服务器的TCP连接
2在建立TCP时向服务器发送HTTP GET请求
三。当HTTP响应返回时
4向设置了s小MTU的服务器发送ICMP类型3代码4消息
问题是ICMP TYPE=3 CODE=4消息包括该HTTP响应包的IP报头和部分TCP报头(srt、dst和seq number)。目前,我只是从HTTP响应包中读取每个参数(如IP标识、frag标签、ttl等等)。问题是:有什么方法可以从该数据包中读取整个IP和TCP报头:
ICMP(TYPE=3 CODE=4)/IP Header/TCP Header
我将packet对象转换为dict对象,以使我的解析更容易。 代码:
输出:
^{pr2}$字典看起来像:
希望以下内容能有所帮助:
要仅检索IP标头:
^{pr2}$相关问题 更多 >
编程相关推荐