kbandla / dpkt

fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols
Other
1.09k stars 270 forks source link

The ord() is not needed for Python3 #483

Closed berloha closed 4 years ago

berloha commented 4 years ago

File "Python\lib\site-packages\dpkt\ssl.py", line 34, in unpack padlen = ord(self.data[0]) TypeError: ord() expected string of length 1, but int found

kbandla commented 4 years ago

Can you share the pcap or the ssl packet data that you were trying to parse? Would need it to reproduce the issue

berloha commented 4 years ago

https://cloud.mail.ru/public/jc25/d3oys4QsE Exception on packet #2

obormot commented 4 years ago

While this is a valid bug (dpkt should use compat_ord instead of plain ord), the particular piece of code that crashes sits under SSL2 class, while the pcap has TLS v1.2. @berloha, I suggest using dpkt.ssl.tls_multi_factory(buf) for better results decoding this; it doesn't crash and returns 3 TLS records correctly.

obormot commented 4 years ago

fixed in https://github.com/kbandla/dpkt/pull/484