kamene
kamene copied to clipboard
Using cap file does not work
I wanted to open a cap file and read the packet that is in there but scapy-python3 crashes while the original scapy with Python 2 works fine: test.cap.zip
scapy-python3:
>>> file = rdpcap("test.cap")
>>> len(file)
1
>>> file[0]
...
IndexError: list index out of range
python2 scapy:
>>> file = rdpcap("test.cap")
>>> len(file)
1
>>> file[0]
<RadioTap.....
Confirmed as of 7cd093393ea4c9416b9fa620649ad4e9597c68ed (2017-03-02).
In [1]: file = rdpcap("test.cap")
In [2]: len(file)
Out[2]: 1
In [3]: file[0]
Out[3]: ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/scapy/env/lib/python3.4/site-packages/IPython/core/formatters.py in __call__(self, obj)
670 type_pprinters=self.type_printers,
671 deferred_pprinters=self.deferred_printers)
--> 672 printer.pretty(obj)
673 printer.flush()
674 return stream.getvalue()
/scapy/env/lib/python3.4/site-packages/IPython/lib/pretty.py in pretty(self, obj)
381 if callable(meth):
382 return meth(obj, self, cycle)
--> 383 return _default_pprint(obj, self, cycle)
384 finally:
385 self.end_group()
/scapy/env/lib/python3.4/site-packages/IPython/lib/pretty.py in _default_pprint(obj, p, cycle)
501 if _safe_getattr(klass, '__repr__', None) not in _baseclass_reprs:
502 # A user-provided repr. Find newlines and replace them with p.break_()
--> 503 _repr_pprint(obj, p, cycle)
504 return
505 p.begin_group(1, '<')
/scapy/env/lib/python3.4/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
699 """A pprint that just redirects to the normal repr function."""
700 # Find newlines and replace them with p.break_()
--> 701 output = repr(obj)
702 for idx,output_line in enumerate(output.splitlines()):
703 if idx:
/scapy/env/lib/python3.4/site-packages/scapy/packet.py in __repr__(self)
259 continue
260 if f.name in self.fields:
--> 261 val = f.i2repr(self, self.fields[f.name])
262 elif f.name in self.overloaded_fields:
263 val = f.i2repr(self, self.overloaded_fields[f.name])
/scapy/env/lib/python3.4/site-packages/scapy/fields.py in i2repr(self, pkt, x)
903 if x & 1:
904 if self.multi:
--> 905 r += [ self.names[i] ]
906 else:
907 r += self.names[i]
IndexError: list index out of range
Hi ! Scapy from secdev (https://github.com/secdev/scapy) now does fully supports Python 3.
Feel free to have a look :)
Yes, I'm aware of that. Thank you very much for establishing python3 compatibility! Very nice.
But I also want to thank phaethon for maintaining this fork in the meantime, while the original scapy project ignored the demand for python3 for years.
However, I just want to thank everybody and don't like to get involved in this controversy. The whole story was/is sad enough.