4 Commits

Author SHA256 Message Date
cab2c08fc6 Accepting request 1282974 from devel:languages:python
- Switch to pyproject macros.
- No more greedy globs in %files.

OBS-URL: https://build.opensuse.org/request/show/1282974
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-dpkt?expand=0&rev=12
2025-06-05 18:34:41 +00:00
9acacab8a2 - Switch to pyproject macros.
- No more greedy globs in %files.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dpkt?expand=0&rev=33
2025-06-05 06:08:13 +00:00
64e50ab535 Accepting request 1223764 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1223764
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-dpkt?expand=0&rev=11
2024-11-13 14:28:34 +00:00
9362217190 Accepting request 1223573 from home:glaubitz:branches:devel:languages:python
- Update to 1.9.8
  * Fixed endianness issues in PCAPNG, Loopback
  * Improved MPLS unpacking to include IPv6
  * Fixed unpacking of multiple records in TLS messages
  * Updated docstrings for multiples modules
  * Fixed a long-standing issue where serializing IP would change its length
  * Fixed IEEE 802.11 Beacon byte ordering
  * Graceful handling of PCAPNG option comment UTF-8 decoding errors
  * Added support for PCAPNG Packet Block
  * Added modpcap reader support
- Drop skip-BE-tests.patch, merged upstream

OBS-URL: https://build.opensuse.org/request/show/1223573
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dpkt?expand=0&rev=31
2024-11-12 17:14:57 +00:00
5 changed files with 32 additions and 154 deletions

View File

@@ -1,3 +1,24 @@
-------------------------------------------------------------------
Thu Jun 5 06:03:56 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to pyproject macros.
- No more greedy globs in %files.
-------------------------------------------------------------------
Tue Nov 12 08:50:28 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 1.9.8
* Fixed endianness issues in PCAPNG, Loopback
* Improved MPLS unpacking to include IPv6
* Fixed unpacking of multiple records in TLS messages
* Updated docstrings for multiples modules
* Fixed a long-standing issue where serializing IP would change its length
* Fixed IEEE 802.11 Beacon byte ordering
* Graceful handling of PCAPNG option comment UTF-8 decoding errors
* Added support for PCAPNG Packet Block
* Added modpcap reader support
- Drop skip-BE-tests.patch, merged upstream
-------------------------------------------------------------------
Mon Feb 19 13:27:00 UTC 2024 - Christian Keil <keil@dfn-cert.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-dpkt
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,21 +16,19 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15allpythons}
Name: python-dpkt
Version: 1.9.7.2
Version: 1.9.8
Release: 0
Summary: Packet creation and parsing module for Python
License: BSD-3-Clause
Group: Development/Libraries/Python
URL: https://github.com/kbandla/dpkt
Source: https://github.com/kbandla/dpkt/archive/v%{version}.tar.gz
# PATCH-FIX-UPSTREAM skip-BE-tests.patch gh#kbandla/dpkt#505 mcepl@suse.com
# Adjust tests to work on BE machines, gh#kbandla/dpkt#615
Patch0: skip-BE-tests.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
@@ -48,10 +46,10 @@ the basic TCP/IP protocols.
sed -i -e '/addopts=/d' setup.cfg
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -60,6 +58,7 @@ sed -i -e '/addopts=/d' setup.cfg
%files %{python_files}
%license LICENSE
%doc examples AUTHORS README.md docs
%{python_sitelib}/*
%{python_sitelib}/dpkt
%{python_sitelib}/dpkt-%{version}.dist-info
%changelog

View File

@@ -1,142 +0,0 @@
---
dpkt/loopback.py | 24 +++++++++++++++++-------
dpkt/pcapng.py | 24 ++++++++++++++----------
2 files changed, 31 insertions(+), 17 deletions(-)
--- a/dpkt/loopback.py
+++ b/dpkt/loopback.py
@@ -1,6 +1,9 @@
# $Id: loopback.py 38 2007-03-17 03:33:16Z dugsong $
# -*- coding: utf-8 -*-
"""Platform-dependent loopback header."""
+
+# https://wiki.wireshark.org/NullLoopback
+
from __future__ import absolute_import
from . import dpkt
@@ -24,17 +27,23 @@ class Loopback(dpkt.Packet):
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
- if self.family == 2:
- self.data = ip.IP(self.data)
-
- elif self.family == 0x02000000:
+ if self.family in (0x02, 0x02000000):
self.family = 2
self.data = ip.IP(self.data)
- elif self.family in (24, 28, 30):
+ elif self.family in (0x18, 0x18000000):
+ self.family = 24
self.data = ip6.IP6(self.data)
- elif self.family > 1500:
+ elif self.family in (0x1c, 0x1c000000):
+ self.family = 28
+ self.data = ip6.IP6(self.data)
+
+ elif self.family in (0x1e, 0x1e000000):
+ self.family = 30
+ self.data = ip6.IP6(self.data)
+
+ else:
self.data = ethernet.Ethernet(self.data)
@@ -43,7 +52,7 @@ def test_ethernet_unpack():
hdr = b'\x00\x02\x00\x02'
lo = Loopback(hdr + buf)
- assert lo.family == 33554944
+ assert lo.family in (0x02000200, 0x00020002) # little endian, big endian
assert isinstance(lo.data, ethernet.Ethernet)
assert lo.data.src == b'\x07\x08\t\n\x0b\x0c'
assert lo.data.dst == b'\x01\x02\x03\x04\x05\x06'
@@ -61,6 +70,7 @@ def test_ip_unpack():
def test_ip6_unpack():
+
import struct
buf = (b'\x60\x00\x00\x00\x00\x14\x06\x38\x26\x07\xf8\xb0\x40\x0c\x0c\x03\x00\x00\x00\x00\x00\x00'
b'\x00\x1a\x20\x01\x04\x70\xe5\xbf\xde\xad\x49\x57\x21\x74\xe8\x2c\x48\x87')
--- a/dpkt/pcapng.py
+++ b/dpkt/pcapng.py
@@ -888,6 +888,10 @@ def define_testdata():
def shb_idb_epb_be(self):
return self.valid_shb_be, self.valid_idb_be, self.valid_epb_be
+ @property
+ def shb_idb_epb(self):
+ return self.shb_idb_epb_le if sys.byteorder == 'little' else self.shb_idb_epb_be
+
return TestData()
@@ -1138,15 +1142,14 @@ def test_custom_read_write():
fobj.close()
# test pcapng customized writing
- if sys.byteorder == 'little':
- shb, idb, epb = define_testdata().shb_idb_epb_le
- else:
- shb, idb, epb = define_testdata().shb_idb_epb_be
+ shb, idb, epb = define_testdata().shb_idb_epb
fobj = BytesIO()
writer = Writer(fobj, shb=shb, idb=idb)
writer.writepkt(epb, ts=1442984653.210838)
- assert fobj.getvalue() == buf
+ # .valid_pcapng buf was collected on a little endian system
+ if sys.byteorder == 'little':
+ assert fobj.getvalue() == buf
fobj.close()
# same with timestamps defined inside EPB
@@ -1156,14 +1159,15 @@ def test_custom_read_write():
fobj = BytesIO()
writer = Writer(fobj, shb=shb, idb=idb)
writer.writepkt(epb)
- assert fobj.getvalue() == buf
+ if sys.byteorder == 'little':
+ assert fobj.getvalue() == buf
fobj.close()
def test_multi_idb_writer():
"""Test writing multiple interface description blocks into pcapng and read it"""
fobj = BytesIO()
- shb, idb, epb = define_testdata().shb_idb_epb_le
+ shb, idb, epb = define_testdata().shb_idb_epb
writer = Writer(fobj, shb=shb, idb=[idb, idb])
writer.writepkt(epb)
@@ -1190,7 +1194,7 @@ def test_writer_validate_instance():
def test_writepkt_epb_ts():
"""writepkt should assign ts_high/low for epb if they are 0"""
global time
- shb, idb, epb = define_testdata().shb_idb_epb_le
+ shb, idb, epb = define_testdata().shb_idb_epb
writer = Writer(fobj, shb=shb, idb=idb) # noqa
epb.ts_high = epb.ts_low = 0
ts = 1454725786.526401
@@ -1296,7 +1300,7 @@ def test_pcapng_block_unpack():
def test_epb_unpack():
"""EnhancedPacketBlock can only unpack data >64 bytes, the length of their header"""
- shb, idb, epb = define_testdata().shb_idb_epb_be
+ shb, idb, epb = define_testdata().shb_idb_epb
buf = b'quite-long-but-not-long-enough-at-least-32'
try:
epb.unpack(buf)
@@ -1306,7 +1310,7 @@ def test_epb_unpack():
def test_epb_unpack_length_mismatch():
"""Force calculated len to be 0 when unpacking epb, this should fail when unpacking"""
- shb, idb, epb = define_testdata().shb_idb_epb_be
+ shb, idb, epb = define_testdata().shb_idb_epb
unpackme = bytes(epb)
unpackme = unpackme[:-4] + b'\x00' * 4

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8570d7282c7fb8a7ea378bbc3ff7862637a704f1b2e6fd3b38ce1b5c3cbe28e1
size 183683

3
v1.9.8.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9990639e19a9c8f1db4af453b7e6a45ef2995ec03e13bac35b9824839fd46867
size 196917