Skip to content

Commit

Permalink
Changes to expose extended attribute extents #597 (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored May 1, 2022
1 parent 056c69d commit 39937ee
Show file tree
Hide file tree
Showing 6 changed files with 40 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 (>= 20201107), libfsext-python3 (>= 20220112), libfshfs-python3 (>= 20220115), libfsntfs-python3 (>= 20211229), libfsxfs-python3 (>= 20220113), 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 (>= 20211113), 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 (>= 20220501), libfsext-python3 (>= 20220112), libfshfs-python3 (>= 20220427), libfsntfs-python3 (>= 20211229), libfsxfs-python3 (>= 20220113), 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 (>= 20211113), 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 @@ -50,7 +50,7 @@ version_property: get_version()
[pyfsapfs]
dpkg_name: libfsapfs-python3
l2tbinaries_name: libfsapfs
minimum_version: 20201107
minimum_version: 20220501
pypi_name: libfsapfs-python
rpm_name: libfsapfs-python3
version_property: get_version()
Expand All @@ -66,7 +66,7 @@ version_property: get_version()
[pyfshfs]
dpkg_name: libfshfs-python3
l2tbinaries_name: libfshfs
minimum_version: 20220115
minimum_version: 20220427
pypi_name: libfshfs-python
rpm_name: libfshfs-python3
version_property: get_version()
Expand Down
25 changes: 25 additions & 0 deletions dfvfs/vfs/apfs_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 APFSExtendedAttribute(attribute.Attribute):
Expand All @@ -31,6 +33,29 @@ def name(self):
"""str: name."""
return self._fsapfs_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._fsapfs_extended_attribute.number_of_extents):
extent_offset, extent_size, extent_flags = (
self._fsapfs_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
8 changes: 8 additions & 0 deletions dfvfs/vfs/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ def type_indicator(self):
"""str: type indicator or None if not known."""
return getattr(self, 'TYPE_INDICATOR', None)

def GetExtents(self):
"""Retrieves the extents.
Returns:
list[Extent]: the extents of the attribute data.
"""
return []


class StatAttribute(object):
"""Attribute that represents a POSIX stat.
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dfdatetime >= 20211113
dtfabric >= 20220219
libbde-python >= 20220121
libewf-python >= 20131210
libfsapfs-python >= 20201107
libfsapfs-python >= 20220501
libfsext-python >= 20220112
libfshfs-python >= 20220115
libfshfs-python >= 20220427
libfsntfs-python >= 20211229
libfsxfs-python >= 20220113
libfvde-python >= 20220121
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ doc_files = ACKNOWLEDGEMENTS
build_requires = python3-setuptools
requires = libbde-python3 >= 20220121
libewf-python3 >= 20131210
libfsapfs-python3 >= 20201107
libfsapfs-python3 >= 20220501
libfsext-python3 >= 20220112
libfshfs-python3 >= 20220115
libfshfs-python3 >= 20220427
libfsntfs-python3 >= 20211229
libfsxfs-python3 >= 20220113
libfvde-python3 >= 20220121
Expand Down

0 comments on commit 39937ee

Please sign in to comment.