Scapy rdpcap 函数错误 "MemoryError"

Scapy rdpcap function error "MemoryError"

我想用rdpcap开流量抓包

cap = rdpcap("Chall_1.pcapng")

但我收到以下错误,我不知道如何解决。

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 979, in __call__
    i.__init__(filename, fdesc, magic)
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 1124, in __init__
    RawPcapReader.__init__(self, filename, fdesc, magic)
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 1035, in __init__
    raise Scapy_Exception(
scapy.error.Scapy_Exception: Not a pcap capture file (bad magic: b'\n\r\r\n')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/valentin/Desktop/Tema3/ctf1.py", line 29, in <module>
    cap = rdpcap("Chall_1.pcapng")
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 950, in rdpcap
    with PcapReader(filename) as fdesc:
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 985, in __call__
    i.__init__(filename, fdesc, magic)
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 1320, in __init__
    RawPcapNgReader.__init__(self, filename, fdesc, magic)
  File "/usr/lib/python3/dist-packages/scapy/utils.py", line 1209, in __init__
    self.f.read(blocklen - 24)
MemoryError

我从this Scapy pull request that the intent is that rdpcap() be able to open both pcap and pcapng files. If that's not working, then it's presumably a Scapy bug; please report it on the Scapy issue list推断。

问题是我的虚拟机内存不足。