Skip to content

Commit

Permalink
Changes to expose extended attribute extents log2timeline#597
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Aug 31, 2022
1 parent b185568 commit 6e961b1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/dpkg/control
Original file line number Diff line number Diff line change
Expand Up @@ -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 (>= 20220529), libfsfat-python3 (>= 20220816), libfshfs-python3 (>= 20220709), libfsntfs-python3 (>= 20211229), libfsxfs-python3 (>= 20220706), 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 (>= 20220816), 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 (>= 20220816), libfshfs-python3 (>= 20220709), 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 (>= 20220816), 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
Expand Down
4 changes: 2 additions & 2 deletions dependencies.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ version_property: get_version()
[pyfsext]
dpkg_name: libfsext-python3
l2tbinaries_name: libfsext
minimum_version: 20220529
minimum_version: 20220829
pypi_name: libfsext-python
rpm_name: libfsext-python3
version_property: get_version()
Expand Down Expand Up @@ -90,7 +90,7 @@ version_property: get_version()
[pyfsxfs]
dpkg_name: libfsxfs-python3
l2tbinaries_name: libfsxfs
minimum_version: 20220706
minimum_version: 20220829
pypi_name: libfsxfs-python
rpm_name: libfsxfs-python3
version_property: get_version()
Expand Down
25 changes: 25 additions & 0 deletions dfvfs/vfs/ext_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

import os

from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.vfs import attribute
from dfvfs.vfs import extent


class EXTExtendedAttribute(attribute.Attribute):
Expand All @@ -31,6 +33,29 @@ def name(self):
"""str: name."""
return self._fsext_extended_attribute.name

def GetExtents(self):
"""Retrieves the extents.
Returns:
list[Extent]: the extents of the attribute data.
"""
extents = []
for extent_index in range(
self._fsext_extended_attribute.number_of_extents):
extent_offset, extent_size, extent_flags = (
self._fsext_extended_attribute.get_extent(extent_index))

if extent_flags & 0x1:
extent_type = definitions.EXTENT_TYPE_SPARSE
else:
extent_type = definitions.EXTENT_TYPE_DATA

data_stream_extent = extent.Extent(
extent_type=extent_type, offset=extent_offset, size=extent_size)
extents.append(data_stream_extent)

return extents

# Note: that the following functions do not follow the style guide
# because they are part of the file-like object interface.
# pylint: disable=invalid-name
Expand Down
25 changes: 25 additions & 0 deletions dfvfs/vfs/xfs_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

import os

from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.vfs import attribute
from dfvfs.vfs import extent


class XFSExtendedAttribute(attribute.Attribute):
Expand All @@ -31,6 +33,29 @@ def name(self):
"""str: name."""
return self._fsxfs_extended_attribute.name

def GetExtents(self):
"""Retrieves the extents.
Returns:
list[Extent]: the extents of the attribute data.
"""
extents = []
for extent_index in range(
self._fsxfs_extended_attribute.number_of_extents):
extent_offset, extent_size, extent_flags = (
self._fsxfs_extended_attribute.get_extent(extent_index))

if extent_flags & 0x1:
extent_type = definitions.EXTENT_TYPE_SPARSE
else:
extent_type = definitions.EXTENT_TYPE_DATA

data_stream_extent = extent.Extent(
extent_type=extent_type, offset=extent_offset, size=extent_size)
extents.append(data_stream_extent)

return extents

# Note: that the following functions do not follow the style guide
# because they are part of the file-like object interface.
# pylint: disable=invalid-name
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ dtfabric >= 20220219
libbde-python >= 20220121
libewf-python >= 20131210
libfsapfs-python >= 20220709
libfsext-python >= 20220529
libfsext-python >= 20220829
libfsfat-python >= 20220816
libfshfs-python >= 20220709
libfsntfs-python >= 20211229
libfsxfs-python >= 20220706
libfsxfs-python >= 20220829
libfvde-python >= 20220121
libfwnt-python >= 20210717
libluksde-python >= 20220121
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ build_requires = python3-setuptools
requires = libbde-python3 >= 20220121
libewf-python3 >= 20131210
libfsapfs-python3 >= 20220709
libfsext-python3 >= 20220529
libfsext-python3 >= 20220829
libfsfat-python3 >= 20220816
libfshfs-python3 >= 20220709
libfsntfs-python3 >= 20211229
libfsxfs-python3 >= 20220706
libfsxfs-python3 >= 20220829
libfvde-python3 >= 20220121
libfwnt-python3 >= 20210717
libluksde-python3 >= 20220121
Expand Down

0 comments on commit 6e961b1

Please sign in to comment.