scapy
scapy copied to clipboard
rdpcap KeyError
Brief description
cannot read pcap file, get KeyError
Scapy version
2.4.3
Python version
'3.10.4 | packaged by conda-forge | (main, Mar 30 2022, 08:38:02) [MSC v.1916 64 bit (AMD64)]'
Operating system
Windows 10
Additional environment information
none
How to reproduce
load file pcap
rdpcap('file.pcap')
Actual result
KeyError Traceback (most recent call last) File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:1212, in PcapNgReader.read_packet(self, size) 1211 try: -> 1212 p = conf.l2typeslinktype 1213 except KeyboardInterrupt:
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\config.py:161, in Num2Layer.getitem(self, item) 160 return self.layer2num[item] --> 161 return self.num2layer[item]
KeyError: 1
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last) Input In [10], in <cell line: 1>() ----> 1 rdpcap('data/file.pcap')
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:861, in rdpcap(filename, count)
855 """Read a pcap or pcapng file and return a packet list
856
857 count: read only
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:1225, in PcapNgReader.read_all(self, count) 1224 def read_all(self, count=-1): -> 1225 res = RawPcapNgReader.read_all(self, count) 1226 from scapy import plist 1227 return plist.PacketList(res, name=os.path.basename(self.filename))
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:999, in RawPcapReader.read_all(self, count) 997 count -= 1 998 try: --> 999 p = self.read_packet() 1000 except EOFError: 1001 break
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:1218, in PcapNgReader.read_packet(self, size) 1216 if conf.debug_dissector: 1217 raise -> 1218 p = conf.raw_layer(s) 1219 if tshigh is not None: 1220 p.time = float((tshigh << 32) + tslow) / tsresol
TypeError: 'NoneType' object is not callable
Expected result
packet list
Related resources
none
Could you try to trigger the issue with the current master branch? If the issue persist, please share a small pcap containing the packet that triggers the crash.
Sent from my iPhone
On 31 Jul 2022, at 20:09, Dr. Hanan Shteingart @.***> wrote:
Brief description
cannot read pcap file, get KeyError
Scapy version
2.4.3
Python version
'3.10.4 | packaged by conda-forge | (main, Mar 30 2022, 08:38:02) [MSC v.1916 64 bit (AMD64)]'
Operating system
Windows 10
Additional environment information
none
How to reproduce
load file pcap
rdpcap('file.pcap')
Actual result
KeyError Traceback (most recent call last) File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:1212, in PcapNgReader.read_packet(self, size) 1211 try: -> 1212 p = conf.l2typeslinktype 1213 except KeyboardInterrupt:
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\config.py:161, in Num2Layer.getitem(self, item) 160 return self.layer2num[item] --> 161 return self.num2layer[item]
KeyError: 1
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last) Input In [10], in <cell line: 1>() ----> 1 rdpcap('data/file.pcap')
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:861, in rdpcap(filename, count) 855 """Read a pcap or pcapng file and return a packet list 856 857 count: read only packets 858 859 """ 860 with PcapReader(filename) as fdesc: --> 861 return fdesc.read_all(count=count)
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:1225, in PcapNgReader.read_all(self, count) 1224 def read_all(self, count=-1): -> 1225 res = RawPcapNgReader.read_all(self, count) 1226 from scapy import plist 1227 return plist.PacketList(res, name=os.path.basename(self.filename))
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:999, in RawPcapReader.read_all(self, count) 997 count -= 1 998 try: --> 999 p = self.read_packet() 1000 except EOFError: 1001 break
File ~\Miniconda3\envs\proj\lib\site-packages\scapy\utils.py:1218, in PcapNgReader.read_packet(self, size) 1216 if conf.debug_dissector: 1217 raise -> 1218 p = conf.raw_layer(s) 1219 if tshigh is not None: 1220 p.time = float((tshigh << 32) + tslow) / tsresol
TypeError: 'NoneType' object is not callable
Expected result
packet list
Related resources
none
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
Closing for no activity. Please re-open if this issue also affects the current master branch, and provide a PCAP sample that triggers the crash.