diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 5f68c260..1c40dc64 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: ['36'] + version: ['37'] container: image: registry.fedoraproject.org/fedora:${{ matrix.version }} steps: @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | dnf copr -y enable @gift/dev - dnf install -y @development-tools python3 python3-devel libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi python3-cryptography python3-dfdatetime python3-dtfabric python3-idna python3-pytsk3 python3-pyxattr python3-pyyaml python3-setuptools + dnf install -y @development-tools python3 python3-devel libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libgzipf-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi python3-cryptography python3-dfdatetime python3-dtfabric python3-idna python3-pytsk3 python3-pyxattr python3-pyyaml python3-setuptools - name: Run tests env: LANG: C.utf8 @@ -58,7 +58,7 @@ jobs: run: | add-apt-repository -y ppa:gift/dev apt-get update -q - apt-get install -y build-essential python3 python3-dev libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi-backend python3-cryptography python3-dfdatetime python3-distutils python3-dtfabric python3-idna python3-pytsk3 python3-pyxattr python3-setuptools python3-yaml + apt-get install -y build-essential python3 python3-dev libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libgzipf-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi-backend python3-cryptography python3-dfdatetime python3-distutils python3-dtfabric python3-idna python3-pytsk3 python3-pyxattr python3-setuptools python3-yaml - name: Run tests env: LANG: en_US.UTF-8 diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 1cc10cb2..5d8e4e86 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -36,7 +36,7 @@ jobs: add-apt-repository -y ppa:deadsnakes/ppa add-apt-repository -y ppa:gift/dev apt-get update -q - apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi-backend python3-cryptography python3-dfdatetime python3-distutils python3-dtfabric python3-idna python3-pip python3-pytsk3 python3-pyxattr python3-setuptools python3-yaml + apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libgzipf-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi-backend python3-cryptography python3-dfdatetime python3-distutils python3-dtfabric python3-idna python3-pip python3-pytsk3 python3-pyxattr python3-setuptools python3-yaml - name: Install tox run: | python3 -m pip install tox diff --git a/.github/workflows/test_tox.yml b/.github/workflows/test_tox.yml index 8c3c1616..77922f1d 100644 --- a/.github/workflows/test_tox.yml +++ b/.github/workflows/test_tox.yml @@ -46,7 +46,7 @@ jobs: add-apt-repository -y ppa:deadsnakes/ppa add-apt-repository -y ppa:gift/dev apt-get update -q - apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi-backend python3-cryptography python3-dfdatetime python3-distutils python3-dtfabric python3-idna python3-pip python3-pytsk3 python3-pyxattr python3-setuptools python3-yaml + apt-get install -y build-essential git libffi-dev python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv libbde-python3 libewf-python3 libfsapfs-python3 libfsext-python3 libfsfat-python3 libfshfs-python3 libfsntfs-python3 libfsxfs-python3 libfvde-python3 libfwnt-python3 libgzipf-python3 libluksde-python3 libmodi-python3 libphdi-python3 libqcow-python3 libsigscan-python3 libsmdev-python3 libsmraw-python3 libvhdi-python3 libvmdk-python3 libvsgpt-python3 libvshadow-python3 libvslvm-python3 python3-cffi-backend python3-cryptography python3-dfdatetime python3-distutils python3-dtfabric python3-idna python3-pip python3-pytsk3 python3-pyxattr python3-setuptools python3-yaml - name: Install tox run: | python3 -m pip install tox diff --git a/config/appveyor/install.ps1 b/config/appveyor/install.ps1 index d1e39363..1990a025 100644 --- a/config/appveyor/install.ps1 +++ b/config/appveyor/install.ps1 @@ -1,6 +1,6 @@ # Script to set up tests on AppVeyor Windows. -$Dependencies = "PyYAML cffi cryptography dfdatetime dtfabric idna libbde libewf libfsapfs libfsext libfsfat libfshfs libfsntfs libfsxfs libfvde libfwnt libluksde libmodi libphdi libqcow libsigscan libsmdev libsmraw libvhdi libvmdk libvsgpt libvshadow libvslvm pytsk3 xattr" +$Dependencies = "PyYAML cffi cryptography dfdatetime dtfabric idna libbde libewf libfsapfs libfsext libfsfat libfshfs libfsntfs libfsxfs libfvde libfwnt libgzipf libluksde libmodi libphdi libqcow libsigscan libsmdev libsmraw libvhdi libvmdk libvsgpt libvshadow libvslvm pytsk3 xattr" $Dependencies = ${Dependencies} -split " " $Output = Invoke-Expression -Command "git clone https://github.com/log2timeline/l2tdevtools.git ..\l2tdevtools 2>&1" diff --git a/config/dpkg/control b/config/dpkg/control index 509328f6..3c773e80 100644 --- a/config/dpkg/control +++ b/config/dpkg/control @@ -9,7 +9,7 @@ Homepage: https://github.com/log2timeline/dfvfs Package: python3-dfvfs Architecture: all -Depends: libbde-python3 (>= 20220121), libewf-python3 (>= 20131210), libfsapfs-python3 (>= 20220709), libfsext-python3 (>= 20220829), libfsfat-python3 (>= 20220925), libfshfs-python3 (>= 20220831), libfsntfs-python3 (>= 20211229), libfsxfs-python3 (>= 20220829), libfvde-python3 (>= 20220121), libfwnt-python3 (>= 20210717), libluksde-python3 (>= 20220121), libmodi-python3 (>= 20210405), libphdi-python3 (>= 20220228), libqcow-python3 (>= 20201213), libsigscan-python3 (>= 20191221), libsmdev-python3 (>= 20140529), libsmraw-python3 (>= 20140612), libvhdi-python3 (>= 20201014), libvmdk-python3 (>= 20140421), libvsgpt-python3 (>= 20211115), libvshadow-python3 (>= 20160109), libvslvm-python3 (>= 20160109), python3-cffi-backend (>= 1.9.1), python3-cryptography (>= 2.0.2), python3-dfdatetime (>= 20221112), python3-dtfabric (>= 20220219), python3-idna (>= 2.5), python3-pytsk3 (>= 20210419), python3-pyxattr (>= 0.7.2), python3-yaml (>= 3.10), ${misc:Depends} +Depends: libbde-python3 (>= 20220121), libewf-python3 (>= 20131210), libfsapfs-python3 (>= 20220709), libfsext-python3 (>= 20220829), libfsfat-python3 (>= 20220925), libfshfs-python3 (>= 20220831), libfsntfs-python3 (>= 20211229), libfsxfs-python3 (>= 20220829), libfvde-python3 (>= 20220121), libfwnt-python3 (>= 20210717), libgzipf-python3 (>= 20221229), libluksde-python3 (>= 20220121), libmodi-python3 (>= 20210405), libphdi-python3 (>= 20220228), libqcow-python3 (>= 20201213), libsigscan-python3 (>= 20191221), libsmdev-python3 (>= 20140529), libsmraw-python3 (>= 20140612), libvhdi-python3 (>= 20201014), libvmdk-python3 (>= 20140421), libvsgpt-python3 (>= 20211115), libvshadow-python3 (>= 20160109), libvslvm-python3 (>= 20160109), python3-cffi-backend (>= 1.9.1), python3-cryptography (>= 2.0.2), python3-dfdatetime (>= 20221112), python3-dtfabric (>= 20220219), python3-idna (>= 2.5), python3-pytsk3 (>= 20210419), python3-pyxattr (>= 0.7.2), python3-yaml (>= 3.10), ${misc:Depends} Description: Python 3 module of dfVFS dfVFS, or Digital Forensics Virtual File System, provides read-only access to file-system objects from various storage media types and file formats. The goal diff --git a/dependencies.ini b/dependencies.ini index dbe06d94..c170f58b 100644 --- a/dependencies.ini +++ b/dependencies.ini @@ -111,6 +111,14 @@ pypi_name: libfwnt-python rpm_name: libfwnt-python3 version_property: get_version() +[pygzipf] +dpkg_name: libgzipf-python3 +l2tbinaries_name: libgzipf +minimum_version: 20221229 +pypi_name: libgzipf-python +rpm_name: libgzipf-python3 +version_property: get_version() + [pyluksde] dpkg_name: libluksde-python3 l2tbinaries_name: libluksde diff --git a/dfvfs/file_io/gzip_file_io.py b/dfvfs/file_io/gzip_file_io.py index fdf4db36..feab0c3d 100644 --- a/dfvfs/file_io/gzip_file_io.py +++ b/dfvfs/file_io/gzip_file_io.py @@ -1,6 +1,11 @@ # -*- coding: utf-8 -*- """The gzip file-like object.""" +try: + import pygzipf +except ModuleNotFoundError: + pygzipf = None + from dfvfs.file_io import file_object_io from dfvfs.lib import errors from dfvfs.lib import gzipfile @@ -13,16 +18,23 @@ class GzipFile(file_object_io.FileObjectIO): @property def comments(self): """list(str): comments in the gzip file.""" - return [member.comment for member in self._file_object.members] + return [member.comments for member in self._file_object.members] @property def modification_times(self): """list(int): modification times stored in the gzip file.""" + if pygzipf: + return [member.get_modification_time_as_integer() + for member in self._file_object.members] + return [member.modification_time for member in self._file_object.members] @property def original_filenames(self): """list(str): original filenames stored in the gzip file.""" + if pygzipf: + return [member.name for member in self._file_object.members] + return [member.original_filename for member in self._file_object.members] @property @@ -54,6 +66,12 @@ def _OpenFileObject(self, path_spec): file_object = resolver.Resolver.OpenFileObject( path_spec.parent, resolver_context=self._resolver_context) + if pygzipf: + gzipf_file = pygzipf.file() + gzipf_file.open_file_object(file_object) + + return gzipf_file + gzip_compressed_stream = gzipfile.GzipCompressedStream() gzip_compressed_stream.Open(file_object) diff --git a/dfvfs/lib/gzipfile.py b/dfvfs/lib/gzipfile.py index eaa9a554..fe0b5c7f 100644 --- a/dfvfs/lib/gzipfile.py +++ b/dfvfs/lib/gzipfile.py @@ -83,7 +83,7 @@ class GzipMember(data_format.DataFormat): provides caching of gzip member data during the initial read of each member. Attributes: - comment (str): comment stored in the member. + comments (str): comments stored in the member. member_end_offset (int): offset to the end of the member in the parent file object. member_start_offset (int): offset to the start of the member in the parent @@ -147,7 +147,7 @@ def __init__( # Start offset of the cached uncompressed data of the member. self._cache_start_offset = None - self.comment = None + self.comments = None self.modification_time = None self.operating_system = None self.original_filename = None diff --git a/requirements.txt b/requirements.txt index 5f45e01b..7353713c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,6 +14,7 @@ libfsntfs-python >= 20211229 libfsxfs-python >= 20220829 libfvde-python >= 20220121 libfwnt-python >= 20210717 +libgzipf-python >= 20221229 libluksde-python >= 20220121 libmodi-python >= 20210405 libphdi-python >= 20220228 diff --git a/setup.cfg b/setup.cfg index ecbb4aa1..ffcde2ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,6 +27,7 @@ requires = libbde-python3 >= 20220121 libfsxfs-python3 >= 20220829 libfvde-python3 >= 20220121 libfwnt-python3 >= 20210717 + libgzipf-python3 >= 20221229 libluksde-python3 >= 20220121 libmodi-python3 >= 20210405 libphdi-python3 >= 20220228