标题:python Scapy的read_packet()报错,有大佬知道为啥么
只看楼主
追心ZhXin
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2021-9-6
 问题点数:0 回复次数:0 
python Scapy的read_packet()报错,有大佬知道为啥么
Traceback (most recent call last):
  File "E:/work/pycharm/practice/pcap/refactor.py", line 7, in <module>
    package = pr.read_packet()
  File "E:\work\pycharm\practice\venv\lib\site-packages\scapy\utils.py", line 1349, in read_packet
    rp = super(PcapReader, self)._read_packet(size=size)
  File "E:\work\pycharm\practice\venv\lib\site-packages\scapy\utils.py", line 1255, in _read_packet
    raise EOFError
EOFError


上面是错误信息
下面是源码第7行
from scapy.all import *
filename = "1490个包.pcap"
# 实例化对象
pr = PcapReader(filename)
# 逐包读取
while True:
    package = pr.read_packet()



1255行
    def _read_packet(self, size=MTU):
        # type: (int) -> Tuple[bytes, RawPcapReader.PacketMetadata]
        """return a single packet read from the file as a tuple containing
        (pkt_data, pkt_metadata)

        raise EOFError when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            raise EOFError
        sec, usec, caplen, wirelen = struct.unpack(self.endian + "IIII", hdr)
        return (self.f.read(caplen)[:size],
                RawPcapReader.PacketMetadata(sec=sec, usec=usec,
                                             wirelen=wirelen, caplen=caplen))
搜索更多相关主题的帖子: size line File pycharm python 
2021-09-06 18:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506761-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.051005 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved