在scapy中使用方括号作为数据包头

问题描述 投票:0回答:1

我有一个关于在船首使用方括号时得到的数据的问题。

参考代码:

#!/usr/bin/python3
from scapy.all import *

def spoof_pkt(pkt):
    a = pkt[IP]

pkt = sniff(filter='tcp',prn=spoof_pkt)

上面的代码尝试嗅探tcp数据包。我的问题是,当我在scapy中使用类似pkt[IP]的语法时,是否仅获得IP标头,还是从IP标头开始获取整个数据包?

python scapy
1个回答
0
投票
>>> a = Ether()/IP()/ICMP() >>> a[IP] <IP frag=0 proto=icmp |<ICMP |>>
© www.soinside.com 2019 - 2024. All rights reserved.