Skip to content

Commit 39937ee

Browse files
authored
Changes to expose extended attribute extents #597 (#661)
1 parent 056c69d commit 39937ee

File tree

6 files changed

+40
-7
lines changed

6 files changed

+40
-7
lines changed

config/dpkg/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Homepage: https://github.com/log2timeline/dfvfs
99

1010
Package: python3-dfvfs
1111
Architecture: all
12-
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}
12+
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}
1313
Description: Python 3 module of dfVFS
1414
dfVFS, or Digital Forensics Virtual File System, provides read-only access to
1515
file-system objects from various storage media types and file formats. The goal

dependencies.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ version_property: get_version()
5050
[pyfsapfs]
5151
dpkg_name: libfsapfs-python3
5252
l2tbinaries_name: libfsapfs
53-
minimum_version: 20201107
53+
minimum_version: 20220501
5454
pypi_name: libfsapfs-python
5555
rpm_name: libfsapfs-python3
5656
version_property: get_version()
@@ -66,7 +66,7 @@ version_property: get_version()
6666
[pyfshfs]
6767
dpkg_name: libfshfs-python3
6868
l2tbinaries_name: libfshfs
69-
minimum_version: 20220115
69+
minimum_version: 20220427
7070
pypi_name: libfshfs-python
7171
rpm_name: libfshfs-python3
7272
version_property: get_version()

dfvfs/vfs/apfs_attribute.py

+25
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
import os
55

6+
from dfvfs.lib import definitions
67
from dfvfs.lib import errors
78
from dfvfs.vfs import attribute
9+
from dfvfs.vfs import extent
810

911

1012
class APFSExtendedAttribute(attribute.Attribute):
@@ -31,6 +33,29 @@ def name(self):
3133
"""str: name."""
3234
return self._fsapfs_extended_attribute.name
3335

36+
def GetExtents(self):
37+
"""Retrieves the extents.
38+
39+
Returns:
40+
list[Extent]: the extents of the attribute data.
41+
"""
42+
extents = []
43+
for extent_index in range(
44+
self._fsapfs_extended_attribute.number_of_extents):
45+
extent_offset, extent_size, extent_flags = (
46+
self._fsapfs_extended_attribute.get_extent(extent_index))
47+
48+
if extent_flags & 0x1:
49+
extent_type = definitions.EXTENT_TYPE_SPARSE
50+
else:
51+
extent_type = definitions.EXTENT_TYPE_DATA
52+
53+
data_stream_extent = extent.Extent(
54+
extent_type=extent_type, offset=extent_offset, size=extent_size)
55+
extents.append(data_stream_extent)
56+
57+
return extents
58+
3459
# Note: that the following functions do not follow the style guide
3560
# because they are part of the file-like object interface.
3661
# pylint: disable=invalid-name

dfvfs/vfs/attribute.py

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ def type_indicator(self):
1212
"""str: type indicator or None if not known."""
1313
return getattr(self, 'TYPE_INDICATOR', None)
1414

15+
def GetExtents(self):
16+
"""Retrieves the extents.
17+
18+
Returns:
19+
list[Extent]: the extents of the attribute data.
20+
"""
21+
return []
22+
1523

1624
class StatAttribute(object):
1725
"""Attribute that represents a POSIX stat.

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ dfdatetime >= 20211113
66
dtfabric >= 20220219
77
libbde-python >= 20220121
88
libewf-python >= 20131210
9-
libfsapfs-python >= 20201107
9+
libfsapfs-python >= 20220501
1010
libfsext-python >= 20220112
11-
libfshfs-python >= 20220115
11+
libfshfs-python >= 20220427
1212
libfsntfs-python >= 20211229
1313
libfsxfs-python >= 20220113
1414
libfvde-python >= 20220121

setup.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ doc_files = ACKNOWLEDGEMENTS
1919
build_requires = python3-setuptools
2020
requires = libbde-python3 >= 20220121
2121
libewf-python3 >= 20131210
22-
libfsapfs-python3 >= 20201107
22+
libfsapfs-python3 >= 20220501
2323
libfsext-python3 >= 20220112
24-
libfshfs-python3 >= 20220115
24+
libfshfs-python3 >= 20220427
2525
libfsntfs-python3 >= 20211229
2626
libfsxfs-python3 >= 20220113
2727
libfvde-python3 >= 20220121

0 commit comments

Comments
 (0)