| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1361 人关注过本帖
标题: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
快速回复:python Scapy的read_packet()报错,有大佬知道为啥么
数据加载中...
 
   



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

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