dfvfs 20260712__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dfvfs/__init__.py +7 -0
- dfvfs/analyzer/__init__.py +39 -0
- dfvfs/analyzer/analyzer.py +431 -0
- dfvfs/analyzer/analyzer_helper.py +81 -0
- dfvfs/analyzer/apfs_analyzer_helper.py +31 -0
- dfvfs/analyzer/apfs_container_analyzer_helper.py +31 -0
- dfvfs/analyzer/apm_analyzer_helper.py +47 -0
- dfvfs/analyzer/bde_analyzer_helper.py +37 -0
- dfvfs/analyzer/bzip2_analyzer_helper.py +34 -0
- dfvfs/analyzer/cpio_analyzer_helper.py +43 -0
- dfvfs/analyzer/cs_analyzer_helper.py +31 -0
- dfvfs/analyzer/ewf_analyzer_helper.py +39 -0
- dfvfs/analyzer/ext_analyzer_helper.py +39 -0
- dfvfs/analyzer/fat_analyzer_helper.py +49 -0
- dfvfs/analyzer/gpt_analyzer_helper.py +42 -0
- dfvfs/analyzer/gzip_analyzer_helper.py +31 -0
- dfvfs/analyzer/hfs_analyzer_helper.py +45 -0
- dfvfs/analyzer/luksde_analyzer_helper.py +31 -0
- dfvfs/analyzer/lvm_analyzer_helper.py +34 -0
- dfvfs/analyzer/modi_analyzer_helper.py +34 -0
- dfvfs/analyzer/ntfs_analyzer_helper.py +39 -0
- dfvfs/analyzer/phdi_analyzer_helper.py +31 -0
- dfvfs/analyzer/qcow_analyzer_helper.py +37 -0
- dfvfs/analyzer/specification.py +155 -0
- dfvfs/analyzer/tar_analyzer_helper.py +34 -0
- dfvfs/analyzer/tsk_analyzer_helper.py +67 -0
- dfvfs/analyzer/tsk_partition_analyzer_helper.py +38 -0
- dfvfs/analyzer/vhdi_analyzer_helper.py +34 -0
- dfvfs/analyzer/vmdk_analyzer_helper.py +37 -0
- dfvfs/analyzer/vshadow_analyzer_helper.py +34 -0
- dfvfs/analyzer/xfs_analyzer_helper.py +31 -0
- dfvfs/analyzer/xz_analyzer_helper.py +31 -0
- dfvfs/analyzer/zip_analyzer_helper.py +31 -0
- dfvfs/compression/__init__.py +10 -0
- dfvfs/compression/bzip2_decompressor.py +50 -0
- dfvfs/compression/decompressor.py +20 -0
- dfvfs/compression/manager.py +84 -0
- dfvfs/compression/xz_decompressor.py +74 -0
- dfvfs/compression/zlib_decompressor.py +73 -0
- dfvfs/credentials/__init__.py +7 -0
- dfvfs/credentials/apfs_credentials.py +17 -0
- dfvfs/credentials/bde_credentials.py +19 -0
- dfvfs/credentials/credentials.py +23 -0
- dfvfs/credentials/cs_credentials.py +17 -0
- dfvfs/credentials/encrypted_stream_credentials.py +16 -0
- dfvfs/credentials/keychain.py +86 -0
- dfvfs/credentials/luksde_credentials.py +17 -0
- dfvfs/credentials/manager.py +74 -0
- dfvfs/encoding/__init__.py +5 -0
- dfvfs/encoding/base16_decoder.py +39 -0
- dfvfs/encoding/base32_decoder.py +39 -0
- dfvfs/encoding/base64_decoder.py +43 -0
- dfvfs/encoding/decoder.py +20 -0
- dfvfs/encoding/manager.py +79 -0
- dfvfs/encryption/__init__.py +6 -0
- dfvfs/encryption/aes_decrypter.py +105 -0
- dfvfs/encryption/blowfish_decrypter.py +107 -0
- dfvfs/encryption/decrypter.py +36 -0
- dfvfs/encryption/des3_decrypter.py +107 -0
- dfvfs/encryption/manager.py +86 -0
- dfvfs/encryption/rc4_decrypter.py +49 -0
- dfvfs/file_io/__init__.py +0 -0
- dfvfs/file_io/apfs_file_io.py +125 -0
- dfvfs/file_io/apm_file_io.py +175 -0
- dfvfs/file_io/bde_file_io.py +44 -0
- dfvfs/file_io/compressed_stream_io.py +333 -0
- dfvfs/file_io/cpio_file_io.py +146 -0
- dfvfs/file_io/cs_file_io.py +148 -0
- dfvfs/file_io/data_range_io.py +195 -0
- dfvfs/file_io/encoded_stream_io.py +325 -0
- dfvfs/file_io/encrypted_stream_io.py +355 -0
- dfvfs/file_io/ewf_file_io.py +89 -0
- dfvfs/file_io/ext_file_io.py +126 -0
- dfvfs/file_io/fake_file_io.py +140 -0
- dfvfs/file_io/fat_file_io.py +137 -0
- dfvfs/file_io/file_io.py +158 -0
- dfvfs/file_io/file_object_io.py +136 -0
- dfvfs/file_io/gpt_file_io.py +181 -0
- dfvfs/file_io/gzip_file_io.py +97 -0
- dfvfs/file_io/hfs_file_io.py +139 -0
- dfvfs/file_io/luksde_file_io.py +44 -0
- dfvfs/file_io/lvm_file_io.py +128 -0
- dfvfs/file_io/modi_file_io.py +67 -0
- dfvfs/file_io/ntfs_file_io.py +142 -0
- dfvfs/file_io/os_file_io.py +196 -0
- dfvfs/file_io/phdi_file_io.py +127 -0
- dfvfs/file_io/qcow_file_io.py +131 -0
- dfvfs/file_io/raw_file_io.py +89 -0
- dfvfs/file_io/sqlite_blob_file_io.py +263 -0
- dfvfs/file_io/tar_file_io.py +157 -0
- dfvfs/file_io/tsk_file_io.py +247 -0
- dfvfs/file_io/tsk_partition_file_io.py +64 -0
- dfvfs/file_io/vhdi_file_io.py +140 -0
- dfvfs/file_io/vmdk_file_io.py +122 -0
- dfvfs/file_io/vshadow_file_io.py +132 -0
- dfvfs/file_io/xfs_file_io.py +126 -0
- dfvfs/file_io/zip_file_io.py +287 -0
- dfvfs/helpers/__init__.py +0 -0
- dfvfs/helpers/command_line.py +917 -0
- dfvfs/helpers/data_slice.py +79 -0
- dfvfs/helpers/fake_file_system_builder.py +122 -0
- dfvfs/helpers/file_system_searcher.py +694 -0
- dfvfs/helpers/source_scanner.py +963 -0
- dfvfs/helpers/text_file.py +199 -0
- dfvfs/helpers/volume_scanner.py +890 -0
- dfvfs/helpers/windows_path_resolver.py +279 -0
- dfvfs/lib/__init__.py +0 -0
- dfvfs/lib/apfs_helper.py +27 -0
- dfvfs/lib/apm_helper.py +30 -0
- dfvfs/lib/bde_helper.py +55 -0
- dfvfs/lib/cpio.py +368 -0
- dfvfs/lib/cpio.yaml +200 -0
- dfvfs/lib/cs_helper.py +59 -0
- dfvfs/lib/data_format.py +119 -0
- dfvfs/lib/decorators.py +23 -0
- dfvfs/lib/definitions.py +170 -0
- dfvfs/lib/errors.py +45 -0
- dfvfs/lib/ewf_helper.py +108 -0
- dfvfs/lib/glob2regex.py +92 -0
- dfvfs/lib/gzipfile.py +600 -0
- dfvfs/lib/gzipfile.yaml +90 -0
- dfvfs/lib/luksde_helper.py +39 -0
- dfvfs/lib/lvm_helper.py +33 -0
- dfvfs/lib/raw_helper.py +397 -0
- dfvfs/lib/sqlite_database.py +210 -0
- dfvfs/lib/tsk_image.py +55 -0
- dfvfs/lib/tsk_partition.py +172 -0
- dfvfs/lib/vshadow_helper.py +30 -0
- dfvfs/mount/__init__.py +0 -0
- dfvfs/mount/manager.py +71 -0
- dfvfs/path/__init__.py +37 -0
- dfvfs/path/apfs_container_path_spec.py +51 -0
- dfvfs/path/apfs_path_spec.py +51 -0
- dfvfs/path/apm_path_spec.py +51 -0
- dfvfs/path/bde_path_spec.py +63 -0
- dfvfs/path/compressed_stream_path_spec.py +43 -0
- dfvfs/path/cpio_path_spec.py +32 -0
- dfvfs/path/cs_path_spec.py +77 -0
- dfvfs/path/data_range_path_spec.py +49 -0
- dfvfs/path/encoded_stream_path_spec.py +43 -0
- dfvfs/path/encrypted_stream_path_spec.py +78 -0
- dfvfs/path/ewf_path_spec.py +30 -0
- dfvfs/path/ext_path_spec.py +51 -0
- dfvfs/path/factory.py +136 -0
- dfvfs/path/fake_path_spec.py +36 -0
- dfvfs/path/fat_path_spec.py +51 -0
- dfvfs/path/gpt_path_spec.py +51 -0
- dfvfs/path/gzip_path_spec.py +30 -0
- dfvfs/path/hfs_path_spec.py +60 -0
- dfvfs/path/location_path_spec.py +34 -0
- dfvfs/path/luksde_path_spec.py +46 -0
- dfvfs/path/lvm_path_spec.py +51 -0
- dfvfs/path/modi_path_spec.py +30 -0
- dfvfs/path/mount_path_spec.py +42 -0
- dfvfs/path/ntfs_path_spec.py +74 -0
- dfvfs/path/os_path_spec.py +49 -0
- dfvfs/path/path_spec.py +139 -0
- dfvfs/path/phdi_path_spec.py +30 -0
- dfvfs/path/qcow_path_spec.py +30 -0
- dfvfs/path/raw_path_spec.py +30 -0
- dfvfs/path/sqlite_blob_path_spec.py +89 -0
- dfvfs/path/tar_path_spec.py +32 -0
- dfvfs/path/tsk_partition_path_spec.py +58 -0
- dfvfs/path/tsk_path_spec.py +62 -0
- dfvfs/path/vhdi_path_spec.py +30 -0
- dfvfs/path/vmdk_path_spec.py +30 -0
- dfvfs/path/vshadow_path_spec.py +51 -0
- dfvfs/path/xfs_path_spec.py +51 -0
- dfvfs/path/zip_path_spec.py +32 -0
- dfvfs/resolver/__init__.py +0 -0
- dfvfs/resolver/context.py +142 -0
- dfvfs/resolver/resolver.py +182 -0
- dfvfs/resolver_helpers/__init__.py +130 -0
- dfvfs/resolver_helpers/apfs_container_resolver_helper.py +29 -0
- dfvfs/resolver_helpers/apfs_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/apm_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/bde_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/compressed_stream_resolver_helper.py +42 -0
- dfvfs/resolver_helpers/cpio_resolver_helper.py +41 -0
- dfvfs/resolver_helpers/cs_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/data_range_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/encoded_stream_resolver_helper.py +42 -0
- dfvfs/resolver_helpers/encrypted_stream_resolver_helper.py +42 -0
- dfvfs/resolver_helpers/ewf_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/ext_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/fake_resolver_helper.py +17 -0
- dfvfs/resolver_helpers/fat_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/gpt_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/gzip_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/hfs_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/luksde_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/lvm_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/manager.py +70 -0
- dfvfs/resolver_helpers/modi_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/ntfs_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/os_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/phdi_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/qcow_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/raw_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/resolver_helper.py +66 -0
- dfvfs/resolver_helpers/sqlite_blob_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/tar_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/tsk_partition_resolver_helper.py +42 -0
- dfvfs/resolver_helpers/tsk_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/vhdi_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/vmdk_resolver_helper.py +27 -0
- dfvfs/resolver_helpers/vshadow_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/xfs_resolver_helper.py +40 -0
- dfvfs/resolver_helpers/zip_resolver_helper.py +40 -0
- dfvfs/serializer/__init__.py +0 -0
- dfvfs/serializer/json_serializer.py +165 -0
- dfvfs/serializer/serializer.py +34 -0
- dfvfs/vfs/__init__.py +0 -0
- dfvfs/vfs/apfs_attribute.py +122 -0
- dfvfs/vfs/apfs_container_directory.py +33 -0
- dfvfs/vfs/apfs_container_file_entry.py +178 -0
- dfvfs/vfs/apfs_container_file_system.py +182 -0
- dfvfs/vfs/apfs_directory.py +46 -0
- dfvfs/vfs/apfs_file_entry.py +289 -0
- dfvfs/vfs/apfs_file_system.py +206 -0
- dfvfs/vfs/apm_directory.py +43 -0
- dfvfs/vfs/apm_file_entry.py +126 -0
- dfvfs/vfs/apm_file_system.py +143 -0
- dfvfs/vfs/attribute.py +61 -0
- dfvfs/vfs/bde_file_entry.py +74 -0
- dfvfs/vfs/bde_file_system.py +98 -0
- dfvfs/vfs/compressed_stream_file_entry.py +51 -0
- dfvfs/vfs/compressed_stream_file_system.py +79 -0
- dfvfs/vfs/cpio_directory.py +49 -0
- dfvfs/vfs/cpio_file_entry.py +229 -0
- dfvfs/vfs/cpio_file_system.py +157 -0
- dfvfs/vfs/cs_directory.py +36 -0
- dfvfs/vfs/cs_file_entry.py +154 -0
- dfvfs/vfs/cs_file_system.py +163 -0
- dfvfs/vfs/data_range_file_entry.py +42 -0
- dfvfs/vfs/data_range_file_system.py +90 -0
- dfvfs/vfs/data_stream.py +44 -0
- dfvfs/vfs/directory.py +41 -0
- dfvfs/vfs/encoded_stream_file_entry.py +51 -0
- dfvfs/vfs/encoded_stream_file_system.py +79 -0
- dfvfs/vfs/encrypted_stream_file_entry.py +51 -0
- dfvfs/vfs/encrypted_stream_file_system.py +82 -0
- dfvfs/vfs/ext_attribute.py +122 -0
- dfvfs/vfs/ext_directory.py +46 -0
- dfvfs/vfs/ext_file_entry.py +310 -0
- dfvfs/vfs/ext_file_system.py +173 -0
- dfvfs/vfs/extent.py +27 -0
- dfvfs/vfs/fake_directory.py +37 -0
- dfvfs/vfs/fake_file_entry.py +168 -0
- dfvfs/vfs/fake_file_system.py +179 -0
- dfvfs/vfs/fat_directory.py +46 -0
- dfvfs/vfs/fat_file_entry.py +254 -0
- dfvfs/vfs/fat_file_system.py +199 -0
- dfvfs/vfs/file_entry.py +520 -0
- dfvfs/vfs/file_system.py +257 -0
- dfvfs/vfs/gpt_directory.py +36 -0
- dfvfs/vfs/gpt_file_entry.py +129 -0
- dfvfs/vfs/gpt_file_system.py +180 -0
- dfvfs/vfs/gzip_file_entry.py +60 -0
- dfvfs/vfs/gzip_file_system.py +34 -0
- dfvfs/vfs/hfs_attribute.py +122 -0
- dfvfs/vfs/hfs_data_stream.py +50 -0
- dfvfs/vfs/hfs_directory.py +46 -0
- dfvfs/vfs/hfs_file_entry.py +334 -0
- dfvfs/vfs/hfs_file_system.py +187 -0
- dfvfs/vfs/luksde_file_entry.py +66 -0
- dfvfs/vfs/luksde_file_system.py +98 -0
- dfvfs/vfs/lvm_directory.py +36 -0
- dfvfs/vfs/lvm_file_entry.py +132 -0
- dfvfs/vfs/lvm_file_system.py +153 -0
- dfvfs/vfs/ntfs_attribute.py +157 -0
- dfvfs/vfs/ntfs_data_stream.py +50 -0
- dfvfs/vfs/ntfs_directory.py +58 -0
- dfvfs/vfs/ntfs_file_entry.py +399 -0
- dfvfs/vfs/ntfs_file_system.py +185 -0
- dfvfs/vfs/os_attribute.py +113 -0
- dfvfs/vfs/os_directory.py +54 -0
- dfvfs/vfs/os_file_entry.py +304 -0
- dfvfs/vfs/os_file_system.py +205 -0
- dfvfs/vfs/root_only_file_entry.py +30 -0
- dfvfs/vfs/root_only_file_system.py +66 -0
- dfvfs/vfs/sqlite_blob_directory.py +56 -0
- dfvfs/vfs/sqlite_blob_file_entry.py +145 -0
- dfvfs/vfs/sqlite_blob_file_system.py +112 -0
- dfvfs/vfs/tar_directory.py +68 -0
- dfvfs/vfs/tar_file_entry.py +220 -0
- dfvfs/vfs/tar_file_system.py +186 -0
- dfvfs/vfs/tsk_attribute.py +151 -0
- dfvfs/vfs/tsk_data_stream.py +95 -0
- dfvfs/vfs/tsk_directory.py +119 -0
- dfvfs/vfs/tsk_file_entry.py +874 -0
- dfvfs/vfs/tsk_file_system.py +260 -0
- dfvfs/vfs/tsk_partition_directory.py +71 -0
- dfvfs/vfs/tsk_partition_file_entry.py +144 -0
- dfvfs/vfs/tsk_partition_file_system.py +136 -0
- dfvfs/vfs/vshadow_directory.py +36 -0
- dfvfs/vfs/vshadow_file_entry.py +145 -0
- dfvfs/vfs/vshadow_file_system.py +146 -0
- dfvfs/vfs/xfs_attribute.py +122 -0
- dfvfs/vfs/xfs_directory.py +46 -0
- dfvfs/vfs/xfs_file_entry.py +274 -0
- dfvfs/vfs/xfs_file_system.py +175 -0
- dfvfs/vfs/zip_directory.py +71 -0
- dfvfs/vfs/zip_file_entry.py +218 -0
- dfvfs/vfs/zip_file_system.py +177 -0
- dfvfs/volume/__init__.py +9 -0
- dfvfs/volume/apfs_volume_system.py +53 -0
- dfvfs/volume/apm_volume_system.py +51 -0
- dfvfs/volume/cs_volume_system.py +52 -0
- dfvfs/volume/factory.py +58 -0
- dfvfs/volume/gpt_volume_system.py +51 -0
- dfvfs/volume/lvm_volume_system.py +52 -0
- dfvfs/volume/tsk_volume_system.py +95 -0
- dfvfs/volume/volume_system.py +336 -0
- dfvfs/volume/vshadow_volume_system.py +73 -0
- dfvfs-20260712.dist-info/METADATA +59 -0
- dfvfs-20260712.dist-info/RECORD +322 -0
- dfvfs-20260712.dist-info/WHEEL +5 -0
- dfvfs-20260712.dist-info/licenses/ACKNOWLEDGEMENTS +31 -0
- dfvfs-20260712.dist-info/licenses/AUTHORS +14 -0
- dfvfs-20260712.dist-info/licenses/LICENSE +202 -0
- dfvfs-20260712.dist-info/top_level.txt +1 -0
dfvfs/__init__.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Imports for the format analyzer."""
|
|
2
|
+
|
|
3
|
+
from dfvfs.analyzer import apfs_analyzer_helper
|
|
4
|
+
from dfvfs.analyzer import apfs_container_analyzer_helper
|
|
5
|
+
from dfvfs.analyzer import apm_analyzer_helper
|
|
6
|
+
from dfvfs.analyzer import bde_analyzer_helper
|
|
7
|
+
from dfvfs.analyzer import bzip2_analyzer_helper
|
|
8
|
+
from dfvfs.analyzer import cpio_analyzer_helper
|
|
9
|
+
from dfvfs.analyzer import cs_analyzer_helper
|
|
10
|
+
from dfvfs.analyzer import ewf_analyzer_helper
|
|
11
|
+
from dfvfs.analyzer import ext_analyzer_helper
|
|
12
|
+
from dfvfs.analyzer import fat_analyzer_helper
|
|
13
|
+
from dfvfs.analyzer import gpt_analyzer_helper
|
|
14
|
+
from dfvfs.analyzer import gzip_analyzer_helper
|
|
15
|
+
from dfvfs.analyzer import hfs_analyzer_helper
|
|
16
|
+
from dfvfs.analyzer import luksde_analyzer_helper
|
|
17
|
+
from dfvfs.analyzer import lvm_analyzer_helper
|
|
18
|
+
from dfvfs.analyzer import modi_analyzer_helper
|
|
19
|
+
from dfvfs.analyzer import ntfs_analyzer_helper
|
|
20
|
+
from dfvfs.analyzer import phdi_analyzer_helper
|
|
21
|
+
from dfvfs.analyzer import qcow_analyzer_helper
|
|
22
|
+
from dfvfs.analyzer import tar_analyzer_helper
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
from dfvfs.analyzer import tsk_analyzer_helper
|
|
26
|
+
except ImportError:
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
from dfvfs.analyzer import tsk_partition_analyzer_helper
|
|
31
|
+
except ImportError:
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
from dfvfs.analyzer import vhdi_analyzer_helper
|
|
35
|
+
from dfvfs.analyzer import vmdk_analyzer_helper
|
|
36
|
+
from dfvfs.analyzer import vshadow_analyzer_helper
|
|
37
|
+
from dfvfs.analyzer import xfs_analyzer_helper
|
|
38
|
+
from dfvfs.analyzer import xz_analyzer_helper
|
|
39
|
+
from dfvfs.analyzer import zip_analyzer_helper
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
"""The format analyzer."""
|
|
2
|
+
|
|
3
|
+
import pysigscan
|
|
4
|
+
|
|
5
|
+
from dfvfs.analyzer import specification
|
|
6
|
+
from dfvfs.lib import definitions
|
|
7
|
+
from dfvfs.resolver import resolver
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Analyzer:
|
|
11
|
+
"""Format analyzer."""
|
|
12
|
+
|
|
13
|
+
_SCAN_BUFFER_SIZE = 33 * 1024
|
|
14
|
+
|
|
15
|
+
_analyzer_helpers = {}
|
|
16
|
+
|
|
17
|
+
# The archive format category analyzer helpers that do not have
|
|
18
|
+
# a format specification.
|
|
19
|
+
_archive_remainder_list = None
|
|
20
|
+
|
|
21
|
+
# The archive format category signature scanner.
|
|
22
|
+
_archive_scanner = None
|
|
23
|
+
|
|
24
|
+
# The archive format category specification store.
|
|
25
|
+
_archive_store = None
|
|
26
|
+
|
|
27
|
+
# The compressed stream format category analyzer helpers that do not have
|
|
28
|
+
# a format specification.
|
|
29
|
+
_compressed_stream_remainder_list = None
|
|
30
|
+
|
|
31
|
+
# The compressed stream format category signature scanner.
|
|
32
|
+
_compressed_stream_scanner = None
|
|
33
|
+
|
|
34
|
+
# The compressed stream format category specification store.
|
|
35
|
+
_compressed_stream_store = None
|
|
36
|
+
|
|
37
|
+
# The file system format category analyzer helpers that do not have
|
|
38
|
+
# a format specification.
|
|
39
|
+
_file_system_remainder_list = None
|
|
40
|
+
|
|
41
|
+
# The file system format category signature scanner.
|
|
42
|
+
_file_system_scanner = None
|
|
43
|
+
|
|
44
|
+
# The file system format category specification store.
|
|
45
|
+
_file_system_store = None
|
|
46
|
+
|
|
47
|
+
# The storage media image format category analyzer helpers that do not have
|
|
48
|
+
# a format specification.
|
|
49
|
+
_storage_media_image_remainder_list = None
|
|
50
|
+
|
|
51
|
+
# The storage media image format category signature scanner.
|
|
52
|
+
_storage_media_image_scanner = None
|
|
53
|
+
|
|
54
|
+
# The storage media image format category specification store.
|
|
55
|
+
_storage_media_image_store = None
|
|
56
|
+
|
|
57
|
+
# The volume system format category analyzer helpers that do not have
|
|
58
|
+
# a format specification.
|
|
59
|
+
_volume_system_remainder_list = None
|
|
60
|
+
|
|
61
|
+
# The volume system format category signature scanner.
|
|
62
|
+
_volume_system_scanner = None
|
|
63
|
+
|
|
64
|
+
# The volume system format category specification store.
|
|
65
|
+
_volume_system_store = None
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def _FlushCache(cls, format_categories):
|
|
69
|
+
"""Flushes the cached objects for the specified format categories.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
format_categories (set[str]): format categories.
|
|
73
|
+
"""
|
|
74
|
+
if definitions.FORMAT_CATEGORY_ARCHIVE in format_categories:
|
|
75
|
+
cls._archive_remainder_list = None
|
|
76
|
+
cls._archive_scanner = None
|
|
77
|
+
cls._archive_store = None
|
|
78
|
+
|
|
79
|
+
if definitions.FORMAT_CATEGORY_COMPRESSED_STREAM in format_categories:
|
|
80
|
+
cls._compressed_stream_remainder_list = None
|
|
81
|
+
cls._compressed_stream_scanner = None
|
|
82
|
+
cls._compressed_stream_store = None
|
|
83
|
+
|
|
84
|
+
if definitions.FORMAT_CATEGORY_FILE_SYSTEM in format_categories:
|
|
85
|
+
cls._file_system_remainder_list = None
|
|
86
|
+
cls._file_system_scanner = None
|
|
87
|
+
cls._file_system_store = None
|
|
88
|
+
|
|
89
|
+
if definitions.FORMAT_CATEGORY_STORAGE_MEDIA_IMAGE in format_categories:
|
|
90
|
+
cls._storage_media_image_remainder_list = None
|
|
91
|
+
cls._storage_media_image_scanner = None
|
|
92
|
+
cls._storage_media_image_store = None
|
|
93
|
+
|
|
94
|
+
if definitions.FORMAT_CATEGORY_VOLUME_SYSTEM in format_categories:
|
|
95
|
+
cls._volume_system_remainder_list = None
|
|
96
|
+
cls._volume_system_scanner = None
|
|
97
|
+
cls._volume_system_store = None
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def _GetSignatureScanner(cls, specification_store):
|
|
101
|
+
"""Initializes a signature scanner based on a specification store.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
specification_store (FormatSpecificationStore): specification store.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
pysigscan.scanner: signature scanner.
|
|
108
|
+
"""
|
|
109
|
+
signature_scanner = pysigscan.scanner()
|
|
110
|
+
signature_scanner.set_scan_buffer_size(cls._SCAN_BUFFER_SIZE)
|
|
111
|
+
|
|
112
|
+
for format_specification in specification_store.specifications:
|
|
113
|
+
for signature in format_specification.signatures:
|
|
114
|
+
pattern_offset = signature.offset
|
|
115
|
+
|
|
116
|
+
if pattern_offset is None:
|
|
117
|
+
signature_flags = pysigscan.signature_flags.NO_OFFSET
|
|
118
|
+
elif pattern_offset < 0:
|
|
119
|
+
pattern_offset *= -1
|
|
120
|
+
signature_flags = pysigscan.signature_flags.RELATIVE_FROM_END
|
|
121
|
+
else:
|
|
122
|
+
signature_flags = pysigscan.signature_flags.RELATIVE_FROM_START
|
|
123
|
+
|
|
124
|
+
signature_scanner.add_signature(
|
|
125
|
+
signature.identifier,
|
|
126
|
+
pattern_offset,
|
|
127
|
+
signature.pattern,
|
|
128
|
+
signature_flags,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return signature_scanner
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def _GetSpecificationStore(cls, format_category):
|
|
135
|
+
"""Retrieves the specification store for specified format category.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
format_category (str): format category.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
tuple[FormatSpecificationStore, list[AnalyzerHelper]]: a format
|
|
142
|
+
specification store and remaining analyzer helpers that do not have
|
|
143
|
+
a format specification.
|
|
144
|
+
"""
|
|
145
|
+
specification_store = specification.FormatSpecificationStore()
|
|
146
|
+
remainder_list = []
|
|
147
|
+
|
|
148
|
+
for analyzer_helper in cls._analyzer_helpers.values():
|
|
149
|
+
if not analyzer_helper.IsEnabled():
|
|
150
|
+
continue
|
|
151
|
+
|
|
152
|
+
if format_category in analyzer_helper.format_categories:
|
|
153
|
+
format_specification = analyzer_helper.GetFormatSpecification()
|
|
154
|
+
|
|
155
|
+
if format_specification is not None:
|
|
156
|
+
specification_store.AddSpecification(format_specification)
|
|
157
|
+
else:
|
|
158
|
+
remainder_list.append(analyzer_helper)
|
|
159
|
+
|
|
160
|
+
return specification_store, remainder_list
|
|
161
|
+
|
|
162
|
+
@classmethod
|
|
163
|
+
def _GetTypeIndicators(
|
|
164
|
+
cls,
|
|
165
|
+
signature_scanner,
|
|
166
|
+
specification_store,
|
|
167
|
+
remainder_list,
|
|
168
|
+
path_spec,
|
|
169
|
+
resolver_context=None,
|
|
170
|
+
):
|
|
171
|
+
"""Determines if a file contains a supported format types.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
signature_scanner (pysigscan.scanner): signature scanner.
|
|
175
|
+
specification_store (FormatSpecificationStore): specification store.
|
|
176
|
+
remainder_list (list[AnalyzerHelper]): remaining analyzer helpers that
|
|
177
|
+
do not have a format specification.
|
|
178
|
+
path_spec (PathSpec): path specification.
|
|
179
|
+
resolver_context (Optional[Context]): resolver context, where None
|
|
180
|
+
represents the built-in context which is not multi process safe.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
list[str]: supported format type indicators.
|
|
184
|
+
"""
|
|
185
|
+
type_indicator_list = []
|
|
186
|
+
|
|
187
|
+
file_object = resolver.Resolver.OpenFileObject(
|
|
188
|
+
path_spec, resolver_context=resolver_context
|
|
189
|
+
)
|
|
190
|
+
scan_state = pysigscan.scan_state()
|
|
191
|
+
|
|
192
|
+
signature_scanner.scan_file_object(scan_state, file_object)
|
|
193
|
+
|
|
194
|
+
for scan_result in iter(scan_state.scan_results):
|
|
195
|
+
format_specification = specification_store.GetSpecificationBySignature(
|
|
196
|
+
scan_result.identifier
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
if format_specification.identifier not in type_indicator_list:
|
|
200
|
+
type_indicator_list.append(format_specification.identifier)
|
|
201
|
+
|
|
202
|
+
for analyzer_helper in remainder_list:
|
|
203
|
+
result = analyzer_helper.AnalyzeFileObject(file_object)
|
|
204
|
+
|
|
205
|
+
if result is not None:
|
|
206
|
+
type_indicator_list.append(result)
|
|
207
|
+
|
|
208
|
+
return type_indicator_list
|
|
209
|
+
|
|
210
|
+
@classmethod
|
|
211
|
+
def DeregisterHelper(cls, analyzer_helper):
|
|
212
|
+
"""Deregisters a format analyzer helper.
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
analyzer_helper (AnalyzerHelper): analyzer helper.
|
|
216
|
+
|
|
217
|
+
Raises:
|
|
218
|
+
KeyError: if analyzer helper object is not set for the corresponding
|
|
219
|
+
type indicator.
|
|
220
|
+
"""
|
|
221
|
+
if analyzer_helper.type_indicator not in cls._analyzer_helpers:
|
|
222
|
+
raise KeyError(
|
|
223
|
+
(
|
|
224
|
+
f"Analyzer helper object not set for type indicator: "
|
|
225
|
+
f"{analyzer_helper.type_indicator:s}."
|
|
226
|
+
)
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
analyzer_helper = cls._analyzer_helpers[analyzer_helper.type_indicator]
|
|
230
|
+
|
|
231
|
+
cls._FlushCache(analyzer_helper.format_categories)
|
|
232
|
+
|
|
233
|
+
del cls._analyzer_helpers[analyzer_helper.type_indicator]
|
|
234
|
+
|
|
235
|
+
@classmethod
|
|
236
|
+
def GetArchiveTypeIndicators(cls, path_spec, resolver_context=None):
|
|
237
|
+
"""Determines if a file contains a supported archive types.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
path_spec (PathSpec): path specification.
|
|
241
|
+
resolver_context (Optional[Context]): resolver context, where None
|
|
242
|
+
represents the built-in context which is not multi process safe.
|
|
243
|
+
|
|
244
|
+
Returns:
|
|
245
|
+
list[str]: supported format type indicators.
|
|
246
|
+
"""
|
|
247
|
+
if cls._archive_remainder_list is None or cls._archive_store is None:
|
|
248
|
+
specification_store, remainder_list = cls._GetSpecificationStore(
|
|
249
|
+
definitions.FORMAT_CATEGORY_ARCHIVE
|
|
250
|
+
)
|
|
251
|
+
cls._archive_remainder_list = remainder_list
|
|
252
|
+
cls._archive_store = specification_store
|
|
253
|
+
|
|
254
|
+
if cls._archive_scanner is None:
|
|
255
|
+
cls._archive_scanner = cls._GetSignatureScanner(cls._archive_store)
|
|
256
|
+
|
|
257
|
+
return cls._GetTypeIndicators(
|
|
258
|
+
cls._archive_scanner,
|
|
259
|
+
cls._archive_store,
|
|
260
|
+
cls._archive_remainder_list,
|
|
261
|
+
path_spec,
|
|
262
|
+
resolver_context=resolver_context,
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
@classmethod
|
|
266
|
+
def GetCompressedStreamTypeIndicators(cls, path_spec, resolver_context=None):
|
|
267
|
+
"""Determines if a file contains a supported compressed stream types.
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
path_spec (PathSpec): path specification.
|
|
271
|
+
resolver_context (Optional[Context]): resolver context, where None
|
|
272
|
+
represents the built-in context which is not multi process safe.
|
|
273
|
+
|
|
274
|
+
Returns:
|
|
275
|
+
list[str]: supported format type indicators.
|
|
276
|
+
"""
|
|
277
|
+
if (
|
|
278
|
+
cls._compressed_stream_remainder_list is None
|
|
279
|
+
or cls._compressed_stream_store is None
|
|
280
|
+
):
|
|
281
|
+
specification_store, remainder_list = cls._GetSpecificationStore(
|
|
282
|
+
definitions.FORMAT_CATEGORY_COMPRESSED_STREAM
|
|
283
|
+
)
|
|
284
|
+
cls._compressed_stream_remainder_list = remainder_list
|
|
285
|
+
cls._compressed_stream_store = specification_store
|
|
286
|
+
|
|
287
|
+
if cls._compressed_stream_scanner is None:
|
|
288
|
+
cls._compressed_stream_scanner = cls._GetSignatureScanner(
|
|
289
|
+
cls._compressed_stream_store
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
return cls._GetTypeIndicators(
|
|
293
|
+
cls._compressed_stream_scanner,
|
|
294
|
+
cls._compressed_stream_store,
|
|
295
|
+
cls._compressed_stream_remainder_list,
|
|
296
|
+
path_spec,
|
|
297
|
+
resolver_context=resolver_context,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
@classmethod
|
|
301
|
+
def GetFileSystemTypeIndicators(cls, path_spec, resolver_context=None):
|
|
302
|
+
"""Determines if a file contains a supported file system types.
|
|
303
|
+
|
|
304
|
+
Args:
|
|
305
|
+
path_spec (PathSpec): path specification.
|
|
306
|
+
resolver_context (Optional[Context]): resolver context, where None
|
|
307
|
+
represents the built-in context which is not multi process safe.
|
|
308
|
+
|
|
309
|
+
Returns:
|
|
310
|
+
list[str]: supported format type indicators.
|
|
311
|
+
"""
|
|
312
|
+
if cls._file_system_remainder_list is None or cls._file_system_store is None:
|
|
313
|
+
specification_store, remainder_list = cls._GetSpecificationStore(
|
|
314
|
+
definitions.FORMAT_CATEGORY_FILE_SYSTEM
|
|
315
|
+
)
|
|
316
|
+
cls._file_system_remainder_list = remainder_list
|
|
317
|
+
cls._file_system_store = specification_store
|
|
318
|
+
|
|
319
|
+
if cls._file_system_scanner is None:
|
|
320
|
+
cls._file_system_scanner = cls._GetSignatureScanner(cls._file_system_store)
|
|
321
|
+
|
|
322
|
+
return cls._GetTypeIndicators(
|
|
323
|
+
cls._file_system_scanner,
|
|
324
|
+
cls._file_system_store,
|
|
325
|
+
cls._file_system_remainder_list,
|
|
326
|
+
path_spec,
|
|
327
|
+
resolver_context=resolver_context,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
@classmethod
|
|
331
|
+
def GetStorageMediaImageTypeIndicators(cls, path_spec, resolver_context=None):
|
|
332
|
+
"""Determines if a file contains a supported storage media image types.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
path_spec (PathSpec): path specification.
|
|
336
|
+
resolver_context (Optional[Context]): resolver context, where None
|
|
337
|
+
represents the built-in context which is not multi process safe.
|
|
338
|
+
|
|
339
|
+
Returns:
|
|
340
|
+
list[str]: supported format type indicators.
|
|
341
|
+
"""
|
|
342
|
+
if (
|
|
343
|
+
cls._storage_media_image_remainder_list is None
|
|
344
|
+
or cls._storage_media_image_store is None
|
|
345
|
+
):
|
|
346
|
+
specification_store, remainder_list = cls._GetSpecificationStore(
|
|
347
|
+
definitions.FORMAT_CATEGORY_STORAGE_MEDIA_IMAGE
|
|
348
|
+
)
|
|
349
|
+
cls._storage_media_image_remainder_list = remainder_list
|
|
350
|
+
cls._storage_media_image_store = specification_store
|
|
351
|
+
|
|
352
|
+
if cls._storage_media_image_scanner is None:
|
|
353
|
+
cls._storage_media_image_scanner = cls._GetSignatureScanner(
|
|
354
|
+
cls._storage_media_image_store
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
return cls._GetTypeIndicators(
|
|
358
|
+
cls._storage_media_image_scanner,
|
|
359
|
+
cls._storage_media_image_store,
|
|
360
|
+
cls._storage_media_image_remainder_list,
|
|
361
|
+
path_spec,
|
|
362
|
+
resolver_context=resolver_context,
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
@classmethod
|
|
366
|
+
def GetVolumeSystemTypeIndicators(cls, path_spec, resolver_context=None):
|
|
367
|
+
"""Determines if a file contains a supported volume system types.
|
|
368
|
+
|
|
369
|
+
Args:
|
|
370
|
+
path_spec (PathSpec): path specification.
|
|
371
|
+
resolver_context (Optional[Context]): resolver context, where None
|
|
372
|
+
represents the built-in context which is not multi process safe.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
list[str]: supported format type indicators.
|
|
376
|
+
"""
|
|
377
|
+
if (
|
|
378
|
+
cls._volume_system_remainder_list is None
|
|
379
|
+
or cls._volume_system_store is None
|
|
380
|
+
):
|
|
381
|
+
specification_store, remainder_list = cls._GetSpecificationStore(
|
|
382
|
+
definitions.FORMAT_CATEGORY_VOLUME_SYSTEM
|
|
383
|
+
)
|
|
384
|
+
cls._volume_system_remainder_list = remainder_list
|
|
385
|
+
cls._volume_system_store = specification_store
|
|
386
|
+
|
|
387
|
+
if cls._volume_system_scanner is None:
|
|
388
|
+
cls._volume_system_scanner = cls._GetSignatureScanner(
|
|
389
|
+
cls._volume_system_store
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
type_indicators = cls._GetTypeIndicators(
|
|
393
|
+
cls._volume_system_scanner,
|
|
394
|
+
cls._volume_system_store,
|
|
395
|
+
cls._volume_system_remainder_list,
|
|
396
|
+
path_spec,
|
|
397
|
+
resolver_context=resolver_context,
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
if (
|
|
401
|
+
len(type_indicators) > 1
|
|
402
|
+
and definitions.TYPE_INDICATOR_TSK_PARTITION in type_indicators
|
|
403
|
+
):
|
|
404
|
+
# The TSK partition analyzer is used as a fallback, remove it if
|
|
405
|
+
# an alternative analyzer detected a supported volume system.
|
|
406
|
+
type_indicators.remove(definitions.TYPE_INDICATOR_TSK_PARTITION)
|
|
407
|
+
|
|
408
|
+
return type_indicators
|
|
409
|
+
|
|
410
|
+
@classmethod
|
|
411
|
+
def RegisterHelper(cls, analyzer_helper):
|
|
412
|
+
"""Registers a format analyzer helper.
|
|
413
|
+
|
|
414
|
+
Args:
|
|
415
|
+
analyzer_helper (AnalyzerHelper): analyzer helper.
|
|
416
|
+
|
|
417
|
+
Raises:
|
|
418
|
+
KeyError: if analyzer helper object is already set for the corresponding
|
|
419
|
+
type indicator.
|
|
420
|
+
"""
|
|
421
|
+
if analyzer_helper.type_indicator in cls._analyzer_helpers:
|
|
422
|
+
raise KeyError(
|
|
423
|
+
(
|
|
424
|
+
f"Analyzer helper object already set for type indicator: "
|
|
425
|
+
f"{analyzer_helper.type_indicator:s}."
|
|
426
|
+
)
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
cls._FlushCache(analyzer_helper.format_categories)
|
|
430
|
+
|
|
431
|
+
cls._analyzer_helpers[analyzer_helper.type_indicator] = analyzer_helper
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""The analyzer helper interface."""
|
|
2
|
+
|
|
3
|
+
from dfvfs.lib import errors
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AnalyzerHelper:
|
|
7
|
+
"""Analyzer helper interface."""
|
|
8
|
+
|
|
9
|
+
# pylint: disable=redundant-returns-doc
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
"""Initializes an analyzer helper.
|
|
13
|
+
|
|
14
|
+
Raises:
|
|
15
|
+
ValueError: if a derived analyzer helper class does not define format
|
|
16
|
+
categories or a type indicator.
|
|
17
|
+
"""
|
|
18
|
+
super().__init__()
|
|
19
|
+
|
|
20
|
+
if not getattr(self, "TYPE_INDICATOR", None):
|
|
21
|
+
raise ValueError("Missing type indicator.")
|
|
22
|
+
|
|
23
|
+
if not getattr(self, "FORMAT_CATEGORIES", None):
|
|
24
|
+
raise ValueError("Missing format categories.")
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def format_categories(self):
|
|
28
|
+
"""Retrieves the format categories.
|
|
29
|
+
|
|
30
|
+
The format categories are defined in definitions.FORMAT_CATEGORIES.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
set[str]: format categories, such as archive file or file system.
|
|
34
|
+
"""
|
|
35
|
+
# pylint: disable=no-member
|
|
36
|
+
return self.FORMAT_CATEGORIES
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def type_indicator(self):
|
|
40
|
+
"""Retrieves the type indicator.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
str: type indicator or None if not available.
|
|
44
|
+
"""
|
|
45
|
+
return getattr(self, "TYPE_INDICATOR", None)
|
|
46
|
+
|
|
47
|
+
def AnalyzeFileObject(self, file_object): # pylint: disable=useless-type-doc
|
|
48
|
+
"""Retrieves the format specification.
|
|
49
|
+
|
|
50
|
+
This is the fall through implementation that raises a RuntimeError.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
file_object (FileIO): file-like object.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
str: type indicator if the file-like object contains a supported format
|
|
57
|
+
or None otherwise.
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
NotSupported: since this is the fall through implementation.
|
|
61
|
+
"""
|
|
62
|
+
raise errors.NotSupported("Missing implementation to analyze file-like object.")
|
|
63
|
+
|
|
64
|
+
def GetFormatSpecification(self):
|
|
65
|
+
"""Retrieves the format specification.
|
|
66
|
+
|
|
67
|
+
This is the fall through implementation that returns None.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
FormatSpecification: format specification or None if the format cannot
|
|
71
|
+
be defined by a specification object.
|
|
72
|
+
"""
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
def IsEnabled(self):
|
|
76
|
+
"""Determines if the analyzer helper is enabled.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
bool: True if the analyzer helper is enabled.
|
|
80
|
+
"""
|
|
81
|
+
return True
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""The APFS format analyzer helper implementation."""
|
|
2
|
+
|
|
3
|
+
from dfvfs.analyzer import analyzer
|
|
4
|
+
from dfvfs.analyzer import analyzer_helper
|
|
5
|
+
from dfvfs.analyzer import specification
|
|
6
|
+
from dfvfs.lib import definitions
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class APFSAnalyzerHelper(analyzer_helper.AnalyzerHelper):
|
|
10
|
+
"""APFS analyzer helper."""
|
|
11
|
+
|
|
12
|
+
FORMAT_CATEGORIES = frozenset([definitions.FORMAT_CATEGORY_FILE_SYSTEM])
|
|
13
|
+
|
|
14
|
+
TYPE_INDICATOR = definitions.TYPE_INDICATOR_APFS
|
|
15
|
+
|
|
16
|
+
def GetFormatSpecification(self):
|
|
17
|
+
"""Retrieves the format specification.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
FormatSpecification: format specification or None if the format cannot
|
|
21
|
+
be defined by a specification object.
|
|
22
|
+
"""
|
|
23
|
+
format_specification = specification.FormatSpecification(self.type_indicator)
|
|
24
|
+
|
|
25
|
+
# APFS file system signature.
|
|
26
|
+
format_specification.AddNewSignature(b"APSB", offset=32)
|
|
27
|
+
|
|
28
|
+
return format_specification
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
analyzer.Analyzer.RegisterHelper(APFSAnalyzerHelper())
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""The APFS container format analyzer helper implementation."""
|
|
2
|
+
|
|
3
|
+
from dfvfs.analyzer import analyzer
|
|
4
|
+
from dfvfs.analyzer import analyzer_helper
|
|
5
|
+
from dfvfs.analyzer import specification
|
|
6
|
+
from dfvfs.lib import definitions
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class APFSContainerAnalyzerHelper(analyzer_helper.AnalyzerHelper):
|
|
10
|
+
"""APFS container analyzer helper."""
|
|
11
|
+
|
|
12
|
+
FORMAT_CATEGORIES = frozenset([definitions.FORMAT_CATEGORY_VOLUME_SYSTEM])
|
|
13
|
+
|
|
14
|
+
TYPE_INDICATOR = definitions.TYPE_INDICATOR_APFS_CONTAINER
|
|
15
|
+
|
|
16
|
+
def GetFormatSpecification(self):
|
|
17
|
+
"""Retrieves the format specification.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
FormatSpecification: format specification or None if the format cannot
|
|
21
|
+
be defined by a specification object.
|
|
22
|
+
"""
|
|
23
|
+
format_specification = specification.FormatSpecification(self.type_indicator)
|
|
24
|
+
|
|
25
|
+
# APFS container signature.
|
|
26
|
+
format_specification.AddNewSignature(b"NXSB", offset=32)
|
|
27
|
+
|
|
28
|
+
return format_specification
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
analyzer.Analyzer.RegisterHelper(APFSContainerAnalyzerHelper())
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""The Apple Partition Map (APM) format analyzer helper implementation."""
|
|
2
|
+
|
|
3
|
+
from dfvfs.analyzer import analyzer
|
|
4
|
+
from dfvfs.analyzer import analyzer_helper
|
|
5
|
+
from dfvfs.analyzer import specification
|
|
6
|
+
from dfvfs.lib import definitions
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class APMAnalyzerHelper(analyzer_helper.AnalyzerHelper):
|
|
10
|
+
"""APM analyzer helper."""
|
|
11
|
+
|
|
12
|
+
FORMAT_CATEGORIES = frozenset([definitions.FORMAT_CATEGORY_VOLUME_SYSTEM])
|
|
13
|
+
|
|
14
|
+
TYPE_INDICATOR = definitions.TYPE_INDICATOR_APM
|
|
15
|
+
|
|
16
|
+
def GetFormatSpecification(self):
|
|
17
|
+
"""Retrieves the format specification.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
FormatSpecification: format specification or None if the format cannot
|
|
21
|
+
be defined by a specification object.
|
|
22
|
+
"""
|
|
23
|
+
format_specification = specification.FormatSpecification(self.type_indicator)
|
|
24
|
+
|
|
25
|
+
# APM signature.
|
|
26
|
+
# Note that technically "PM" at offset 512 is the Apple Partion Map
|
|
27
|
+
# signature but using the partition type is less error prone.
|
|
28
|
+
format_specification.AddNewSignature(
|
|
29
|
+
(
|
|
30
|
+
b"Apple_partition_map\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
|
31
|
+
b"\x00"
|
|
32
|
+
),
|
|
33
|
+
offset=560,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return format_specification
|
|
37
|
+
|
|
38
|
+
def IsEnabled(self):
|
|
39
|
+
"""Determines if the analyzer helper is enabled.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
bool: True if the analyzer helper is enabled.
|
|
43
|
+
"""
|
|
44
|
+
return definitions.PREFERRED_APM_BACK_END == self.TYPE_INDICATOR
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
analyzer.Analyzer.RegisterHelper(APMAnalyzerHelper())
|