From 972f0f992f0138f5646c9c71dd54d8be9a9f3742 Mon Sep 17 00:00:00 2001 From: Jerome-PS Date: Thu, 13 Apr 2023 09:36:17 +0200 Subject: [PATCH 1/2] Exception when trying to parse an IPv6 address Unpack expects a byte sequence, not an int. --- pcapng/structs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcapng/structs.py b/pcapng/structs.py index 65e5969..da47b50 100644 --- a/pcapng/structs.py +++ b/pcapng/structs.py @@ -906,7 +906,7 @@ def _decode_value(self, value, ftype): if ftype == TYPE_IPV6_PREFIX: return ( unpack_ipv6(value[:16]), - struct.unpack(self.endianness + "B", value[16]), + struct.unpack(self.endianness + "B", value[16:17]), ) if ftype == TYPE_MACADDR: From a67ec6da2bde102b451815c0dd880f692700134d Mon Sep 17 00:00:00 2001 From: Jerome-PS Date: Mon, 17 Apr 2023 19:15:36 +0000 Subject: [PATCH 2/2] Return int directly --- pcapng/structs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcapng/structs.py b/pcapng/structs.py index da47b50..57f5890 100644 --- a/pcapng/structs.py +++ b/pcapng/structs.py @@ -906,7 +906,7 @@ def _decode_value(self, value, ftype): if ftype == TYPE_IPV6_PREFIX: return ( unpack_ipv6(value[:16]), - struct.unpack(self.endianness + "B", value[16:17]), + value[16] ) if ftype == TYPE_MACADDR: