dissect.vmfs 3.12.dev1__tar.gz → 3.13__tar.gz
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.
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/PKG-INFO +3 -4
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/c_lvm.pyi +1 -2
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/c_vmfs.pyi +1 -2
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/descriptor.py +41 -18
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/resource.py +3 -1
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect.vmfs.egg-info/PKG-INFO +3 -4
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect.vmfs.egg-info/SOURCES.txt +2 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/pyproject.toml +25 -9
- dissect_vmfs-3.13/tests/_data/vmfs/zero5.bin.gz +0 -0
- dissect_vmfs-3.13/tests/_data/vmfs/zero6.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/test_vmfs.py +38 -2
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tox.ini +8 -10
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/.git-blame-ignore-revs +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/.gitattributes +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/COPYRIGHT +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/LICENSE +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/MANIFEST.in +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/README.md +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/__init__.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/address.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/c_lvm.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/c_vmfs.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/exception.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/lvm.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/util.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect/vmfs/vmfs.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect.vmfs.egg-info/dependency_links.txt +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect.vmfs.egg-info/requires.txt +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/dissect.vmfs.egg-info/top_level.txt +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/setup.cfg +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/__init__.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/huge/lvm5.csv.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/huge/lvm6.csv.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/lvm3.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/lvm4.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/lvm5.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/lvm6.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm3-span-0.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm3-span-1.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm4-span-0.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm4-span-1.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm5-span-0.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm5-span-1.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm6-span-0.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/lvm/span/lvm6-span-1.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/span/vmfs5-span-0.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/span/vmfs5-span-1.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/span/vmfs6-span-0.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/span/vmfs6-span-1.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5-no-dense-sbpc.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5-resource-optimized.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5d.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5l.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5ld.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs6-resource-optimized.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs6.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs6d.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs6l.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs6ld.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs.bin.gz +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_docs/Makefile +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_docs/conf.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_docs/index.rst +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/conftest.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/test_exception.py +0 -0
- {dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/test_lvm.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.vmfs
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.13
|
|
4
4
|
Summary: A Dissect module implementing a parser for the VMFS file system, used by VMware virtualization software
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
|
-
License:
|
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
|
7
7
|
Project-URL: homepage, https://dissect.tools
|
|
8
8
|
Project-URL: documentation, https://docs.dissect.tools/en/latest/projects/dissect.vmfs
|
|
9
9
|
Project-URL: repository, https://github.com/fox-it/dissect.vmfs
|
|
@@ -11,14 +11,13 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
11
11
|
Classifier: Environment :: Console
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Intended Audience :: Information Technology
|
|
14
|
-
Classifier: License :: OSI Approved
|
|
15
14
|
Classifier: Operating System :: OS Independent
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Topic :: Internet :: Log Analysis
|
|
18
17
|
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
18
|
Classifier: Topic :: Security
|
|
20
19
|
Classifier: Topic :: Utilities
|
|
21
|
-
Requires-Python:
|
|
20
|
+
Requires-Python: >=3.10
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
22
|
License-File: LICENSE
|
|
24
23
|
License-File: COPYRIGHT
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Generated by cstruct-stubgen
|
|
2
|
-
from typing import BinaryIO, Literal, overload
|
|
2
|
+
from typing import BinaryIO, Literal, TypeAlias, overload
|
|
3
3
|
|
|
4
4
|
import dissect.cstruct as __cs__
|
|
5
|
-
from typing_extensions import TypeAlias
|
|
6
5
|
|
|
7
6
|
class _c_lvm(__cs__.cstruct):
|
|
8
7
|
DISK_BLOCK_SIZE_512B: Literal[512] = ...
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Generated by cstruct-stubgen
|
|
2
|
-
from typing import BinaryIO, Literal, overload
|
|
2
|
+
from typing import BinaryIO, Literal, TypeAlias, overload
|
|
3
3
|
|
|
4
4
|
import dissect.cstruct as __cs__
|
|
5
|
-
from typing_extensions import TypeAlias
|
|
6
5
|
|
|
7
6
|
class _c_vmfs(__cs__.cstruct):
|
|
8
7
|
rootDirDescAddr: Literal[4] = ...
|
|
@@ -19,7 +19,13 @@ from dissect.vmfs.address import (
|
|
|
19
19
|
address_type,
|
|
20
20
|
)
|
|
21
21
|
from dissect.vmfs.c_vmfs import FS3_AddrType, FS3_DescriptorType, FS3_ZeroLevelAddrType, FS6_DirBlockType, c_vmfs
|
|
22
|
-
from dissect.vmfs.exception import
|
|
22
|
+
from dissect.vmfs.exception import (
|
|
23
|
+
FileNotFoundError,
|
|
24
|
+
NotADirectoryError,
|
|
25
|
+
NotAnRDMFileError,
|
|
26
|
+
NotASymlinkError,
|
|
27
|
+
VolumeNotAvailableError,
|
|
28
|
+
)
|
|
23
29
|
from dissect.vmfs.util import vmfs_uuid
|
|
24
30
|
|
|
25
31
|
if TYPE_CHECKING:
|
|
@@ -125,7 +131,7 @@ class FileDescriptor:
|
|
|
125
131
|
type_str = {
|
|
126
132
|
FS3_DescriptorType.DIRECTORY: "dir",
|
|
127
133
|
FS3_DescriptorType.REGFILE: "reg",
|
|
128
|
-
FS3_DescriptorType.
|
|
134
|
+
FS3_DescriptorType.SYSFILE: "sys",
|
|
129
135
|
FS3_DescriptorType.RDM: "rdm",
|
|
130
136
|
}.get(self.type, "oth")
|
|
131
137
|
|
|
@@ -137,8 +143,8 @@ class FileDescriptor:
|
|
|
137
143
|
Lock [type {li.type:x} offset {li.addr.offset} v {li.token}, hb offset {li.hbAddr.offset}
|
|
138
144
|
gen {li.hbGen.gen}, mode {li.mode}, owner {vmfs_uuid(li.owner)} mtime {li.mtime}
|
|
139
145
|
num {li.numHolders} gblnum {li.gblNumHolders} gblgen {li.gblGen} gblbrk {li.gblBrk}]
|
|
140
|
-
Addr <{address_type(self.address)}, {cluster}, {resource}>, gen {fd.generation}, links {fd.
|
|
141
|
-
len {fd.
|
|
146
|
+
Addr <{address_type(self.address)}, {cluster}, {resource}>, gen {fd.generation}, links {fd.linkCount}, type {type_str}, flags {fd.flags:#x}, uid {fd.uid}, gid {fd.gid}, mode {fd.mode:o}
|
|
147
|
+
len {fd.fileLength}, nb {fd.numBlocks} tbz {fd.numTBZBlocksLo | fd.numTBZBlocksHi << 32}, cow {fd.numCOWBlocksLo | fd.numCOWBlocksHi << 32}, newSinceEpoch {fd.newSinceEpochLo | fd.newSinceEpochHi << 32}, zla {fd.zeroLevelAddrType}, bs {fd.blockSize}
|
|
142
148
|
affinityFD <{address_type(fd.affinityFD)},{affinity_cluster},{affinity_resource}>, parentFD <{address_type(fd.parentFD)},{parent_cluster},{parent_resource}>, tbzGranularityShift {fd.tbzGranularityShift}, numLFB {fd.numLFB}
|
|
143
149
|
lastSFBClusterNum {fd.lastSFBClusterNum}, numPreAllocBlocks {fd.numPreAllocBlocks}, numPointerBlocks {fd.numPointerBlocks}
|
|
144
150
|
""").strip() # noqa: E501
|
|
@@ -232,13 +238,19 @@ class FileDescriptor:
|
|
|
232
238
|
|
|
233
239
|
Access the mode through the :attr:`metadata` attribute to get the raw mode value.
|
|
234
240
|
"""
|
|
235
|
-
if stat.S_IFMT(self.metadata.mode)
|
|
241
|
+
if stat.S_IFMT(self.metadata.mode):
|
|
242
|
+
# If the mode already has a type bit set, return it as is
|
|
236
243
|
return self.metadata.mode
|
|
237
244
|
|
|
238
|
-
if self.
|
|
245
|
+
if self.is_dir():
|
|
246
|
+
return self.metadata.mode | stat.S_IFDIR
|
|
247
|
+
|
|
248
|
+
if self.is_symlink():
|
|
239
249
|
return self.metadata.mode | stat.S_IFLNK
|
|
240
|
-
|
|
250
|
+
|
|
251
|
+
if self.is_rdm():
|
|
241
252
|
return self.metadata.mode | stat.S_IFBLK
|
|
253
|
+
|
|
242
254
|
return self.metadata.mode | stat.S_IFREG
|
|
243
255
|
|
|
244
256
|
@property
|
|
@@ -272,11 +284,11 @@ class FileDescriptor:
|
|
|
272
284
|
|
|
273
285
|
def is_dir(self) -> bool:
|
|
274
286
|
"""Return whether this file descriptor is a directory."""
|
|
275
|
-
return self.type == FS3_DescriptorType.DIRECTORY
|
|
287
|
+
return self.type == FS3_DescriptorType.DIRECTORY or (self.is_system() and stat.S_ISDIR(self.metadata.mode))
|
|
276
288
|
|
|
277
289
|
def is_file(self) -> bool:
|
|
278
290
|
"""Return whether this file descriptor is a regular file."""
|
|
279
|
-
return self.type == FS3_DescriptorType.REGFILE
|
|
291
|
+
return self.type == FS3_DescriptorType.REGFILE or (self.is_system() and not stat.S_ISDIR(self.metadata.mode))
|
|
280
292
|
|
|
281
293
|
def is_symlink(self) -> bool:
|
|
282
294
|
"""Return whether this file descriptor is a symlink."""
|
|
@@ -439,7 +451,8 @@ class FileDescriptor5(FileDescriptor):
|
|
|
439
451
|
primary_num = block_num >> self.vmfs._ptr_block_num_shift
|
|
440
452
|
secondary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
|
|
441
453
|
|
|
442
|
-
block
|
|
454
|
+
if (block := self.blocks[primary_num]) == 0:
|
|
455
|
+
return 0
|
|
443
456
|
pb_buf = self.vmfs.resources.read(block)
|
|
444
457
|
|
|
445
458
|
return _get_uint32_index(pb_buf, secondary_num)
|
|
@@ -449,10 +462,12 @@ class FileDescriptor5(FileDescriptor):
|
|
|
449
462
|
secondary_num = (block_num >> self.vmfs._ptr_block_num_shift) & ((1 << self.vmfs._ptr_block_num_shift) - 1)
|
|
450
463
|
tertiary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
|
|
451
464
|
|
|
452
|
-
block
|
|
465
|
+
if (block := self.blocks[primary_num]) == 0:
|
|
466
|
+
return 0
|
|
453
467
|
pb_buf = self.vmfs.resources.read(block)
|
|
454
468
|
|
|
455
|
-
block
|
|
469
|
+
if (block := _get_uint32_index(pb_buf, secondary_num)) == 0:
|
|
470
|
+
return 0
|
|
456
471
|
pb_buf = self.vmfs.resources.read(block)
|
|
457
472
|
|
|
458
473
|
return _get_uint32_index(pb_buf, tertiary_num)
|
|
@@ -470,7 +485,10 @@ class FileDescriptor5(FileDescriptor):
|
|
|
470
485
|
if self.zla == FS3_ZeroLevelAddrType.FILE_DESCRIPTOR_RESIDENT:
|
|
471
486
|
return self._resolve_resident_offset(offset), 0
|
|
472
487
|
|
|
473
|
-
block
|
|
488
|
+
if (block := self._offset_to_block_address(offset)) == 0:
|
|
489
|
+
# Return early with a TBZ set for 0 blocks
|
|
490
|
+
return 0, 1
|
|
491
|
+
|
|
474
492
|
type = address_type(block)
|
|
475
493
|
|
|
476
494
|
if resource := self.vmfs.resources.get(type):
|
|
@@ -706,7 +724,8 @@ class FileDescriptor6(FileDescriptor):
|
|
|
706
724
|
primary_num = block_num >> self.vmfs._ptr_block_num_shift
|
|
707
725
|
secondary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
|
|
708
726
|
|
|
709
|
-
block
|
|
727
|
+
if (block := self.blocks[primary_num]) == 0:
|
|
728
|
+
return 0
|
|
710
729
|
|
|
711
730
|
# Pointer block data can be stored in the .pbc.sf file itself, in .sbc.sf or as regular file block
|
|
712
731
|
# Use the address type to figure it out
|
|
@@ -718,10 +737,12 @@ class FileDescriptor6(FileDescriptor):
|
|
|
718
737
|
secondary_num = (block_num >> self.vmfs._ptr_block_num_shift) & ((1 << self.vmfs._ptr_block_num_shift) - 1)
|
|
719
738
|
tertiary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
|
|
720
739
|
|
|
721
|
-
block
|
|
740
|
+
if (block := self.blocks[primary_num]) == 0:
|
|
741
|
+
return 0
|
|
722
742
|
pb_buf = self.vmfs.resources.read(block)
|
|
723
743
|
|
|
724
|
-
block
|
|
744
|
+
if (block := _get_uint64_index(pb_buf, secondary_num)) == 0:
|
|
745
|
+
return 0
|
|
725
746
|
pb_buf = self.vmfs.resources.read(block)
|
|
726
747
|
|
|
727
748
|
return _get_uint64_index(pb_buf, tertiary_num)
|
|
@@ -739,7 +760,9 @@ class FileDescriptor6(FileDescriptor):
|
|
|
739
760
|
if self.zla == FS3_ZeroLevelAddrType.FILE_DESCRIPTOR_RESIDENT:
|
|
740
761
|
return self._resolve_resident_offset(offset), 0
|
|
741
762
|
|
|
742
|
-
block
|
|
763
|
+
if (block := self._offset_to_block_address(offset)) == 0:
|
|
764
|
+
# Return early with a TBZ set for 0 blocks
|
|
765
|
+
return 0, 0xFF
|
|
743
766
|
type = address_type(block)
|
|
744
767
|
|
|
745
768
|
if resource := self.vmfs.resources.get(type):
|
|
@@ -958,7 +981,7 @@ class BlockStream(AlignedStream):
|
|
|
958
981
|
Eventual file blocks can also differ between FB (filesystem block), SB (sub/small block) and
|
|
959
982
|
LFB (large filesystem block).
|
|
960
983
|
|
|
961
|
-
See :func:`
|
|
984
|
+
See :func:`FileDescriptor5._resolve_offset` and :func:`FileDescriptor6._resolve_offset` for more information on how
|
|
962
985
|
to resolve offsets.
|
|
963
986
|
"""
|
|
964
987
|
|
|
@@ -367,7 +367,9 @@ class ResourceManager:
|
|
|
367
367
|
self.resources = {}
|
|
368
368
|
|
|
369
369
|
def __repr__(self) -> str:
|
|
370
|
-
return
|
|
370
|
+
return (
|
|
371
|
+
f"<ResourceManager {' '.join(RESOURCE_TYPE_ABBREVIATIONS[FS3_ResourceTypeID(r)] for r in self.resources)}>"
|
|
372
|
+
)
|
|
371
373
|
|
|
372
374
|
def __getitem__(self, type: FS3_ResourceTypeID | int) -> ResourceFile:
|
|
373
375
|
"""Get a resource file by its type."""
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.vmfs
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.13
|
|
4
4
|
Summary: A Dissect module implementing a parser for the VMFS file system, used by VMware virtualization software
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
|
-
License:
|
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
|
7
7
|
Project-URL: homepage, https://dissect.tools
|
|
8
8
|
Project-URL: documentation, https://docs.dissect.tools/en/latest/projects/dissect.vmfs
|
|
9
9
|
Project-URL: repository, https://github.com/fox-it/dissect.vmfs
|
|
@@ -11,14 +11,13 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
11
11
|
Classifier: Environment :: Console
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: Intended Audience :: Information Technology
|
|
14
|
-
Classifier: License :: OSI Approved
|
|
15
14
|
Classifier: Operating System :: OS Independent
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Topic :: Internet :: Log Analysis
|
|
18
17
|
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
18
|
Classifier: Topic :: Security
|
|
20
19
|
Classifier: Topic :: Utilities
|
|
21
|
-
Requires-Python:
|
|
20
|
+
Requires-Python: >=3.10
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
22
|
License-File: LICENSE
|
|
24
23
|
License-File: COPYRIGHT
|
|
@@ -54,6 +54,8 @@ tests/_data/vmfs/vmfs6.bin.gz
|
|
|
54
54
|
tests/_data/vmfs/vmfs6d.bin.gz
|
|
55
55
|
tests/_data/vmfs/vmfs6l.bin.gz
|
|
56
56
|
tests/_data/vmfs/vmfs6ld.bin.gz
|
|
57
|
+
tests/_data/vmfs/zero5.bin.gz
|
|
58
|
+
tests/_data/vmfs/zero6.bin.gz
|
|
57
59
|
tests/_data/vmfs/span/vmfs5-span-0.bin.gz
|
|
58
60
|
tests/_data/vmfs/span/vmfs5-span-1.bin.gz
|
|
59
61
|
tests/_data/vmfs/span/vmfs6-span-0.bin.gz
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77.0.0", "setuptools_scm[toml]>=6.4.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dissect.vmfs"
|
|
7
7
|
description = "A Dissect module implementing a parser for the VMFS file system, used by VMware virtualization software"
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
requires-python = "
|
|
10
|
-
license
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = "AGPL-3.0-or-later"
|
|
11
|
+
license-files = ["LICENSE", "COPYRIGHT"]
|
|
11
12
|
authors = [
|
|
12
13
|
{name = "Dissect Team", email = "dissect@fox-it.com"}
|
|
13
14
|
]
|
|
@@ -16,7 +17,6 @@ classifiers = [
|
|
|
16
17
|
"Environment :: Console",
|
|
17
18
|
"Intended Audience :: Developers",
|
|
18
19
|
"Intended Audience :: Information Technology",
|
|
19
|
-
"License :: OSI Approved",
|
|
20
20
|
"Operating System :: OS Independent",
|
|
21
21
|
"Programming Language :: Python :: 3",
|
|
22
22
|
"Topic :: Internet :: Log Analysis",
|
|
@@ -41,9 +41,29 @@ dev = [
|
|
|
41
41
|
"dissect.util>=3.0.dev,<4.0.dev",
|
|
42
42
|
]
|
|
43
43
|
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
test = [
|
|
46
|
+
"pytest",
|
|
47
|
+
]
|
|
48
|
+
lint = [
|
|
49
|
+
"ruff==0.13.1",
|
|
50
|
+
"vermin",
|
|
51
|
+
]
|
|
52
|
+
build = [
|
|
53
|
+
"build",
|
|
54
|
+
]
|
|
55
|
+
debug = [
|
|
56
|
+
"ipdb",
|
|
57
|
+
]
|
|
58
|
+
dev = [
|
|
59
|
+
{include-group = "test"},
|
|
60
|
+
{include-group = "lint"},
|
|
61
|
+
{include-group = "debug"},
|
|
62
|
+
]
|
|
63
|
+
|
|
44
64
|
[tool.ruff]
|
|
45
65
|
line-length = 120
|
|
46
|
-
required-version = ">=0.
|
|
66
|
+
required-version = ">=0.13.1"
|
|
47
67
|
|
|
48
68
|
[tool.ruff.format]
|
|
49
69
|
docstring-code-format = true
|
|
@@ -93,11 +113,7 @@ ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM1
|
|
|
93
113
|
known-first-party = ["dissect.vmfs"]
|
|
94
114
|
known-third-party = ["dissect"]
|
|
95
115
|
|
|
96
|
-
[tool.setuptools]
|
|
97
|
-
license-files = ["LICENSE", "COPYRIGHT"]
|
|
98
|
-
|
|
99
116
|
[tool.setuptools.packages.find]
|
|
100
117
|
include = ["dissect.*"]
|
|
101
118
|
|
|
102
119
|
[tool.setuptools_scm]
|
|
103
|
-
local_scheme = "no-local-version"
|
|
Binary file
|
|
Binary file
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import contextlib
|
|
4
4
|
import gzip
|
|
5
|
+
import stat
|
|
5
6
|
|
|
6
7
|
import pytest
|
|
7
8
|
|
|
@@ -73,11 +74,20 @@ def test_vmfs_basic(path: str | list[str], type: str, request: pytest.FixtureReq
|
|
|
73
74
|
assert FS3_Config.DENSE_SBPC in fs.descriptor.config
|
|
74
75
|
|
|
75
76
|
root_dir = fs.get("/").listdir()
|
|
76
|
-
for name in (".vh.sf", ".pb2.sf", ".pbc.sf", ".fbb.sf", ".fdc.sf", ".sbc.sf") + (
|
|
77
|
+
for name in (".vh.sf", ".pb2.sf", ".pbc.sf", ".fbb.sf", ".fdc.sf", ".sbc.sf", ".sdd.sf") + (
|
|
77
78
|
(".jbc.sf",) if fs.is_vmfs6 else ()
|
|
78
79
|
):
|
|
79
80
|
assert name in root_dir, f"Expected {name} in root directory"
|
|
80
|
-
|
|
81
|
+
|
|
82
|
+
fd = root_dir[name].fd
|
|
83
|
+
assert fd.is_system(), f"{name} should be a system file"
|
|
84
|
+
|
|
85
|
+
if name == ".sdd.sf":
|
|
86
|
+
assert fd.is_dir(), f"{name} should be a directory"
|
|
87
|
+
assert stat.S_ISDIR(fd.mode), f"{name} should be a directory"
|
|
88
|
+
else:
|
|
89
|
+
assert fd.is_file(), f"{name} should be a regular file"
|
|
90
|
+
assert stat.S_ISREG(fd.mode), f"{name} should be a regular file"
|
|
81
91
|
|
|
82
92
|
|
|
83
93
|
@pytest.mark.parametrize(
|
|
@@ -93,6 +103,11 @@ def test_vmfs_content(path: str) -> None:
|
|
|
93
103
|
vs = lvm.LVM(fh)
|
|
94
104
|
fs = vmfs.VMFS(vs.volumes[0].open())
|
|
95
105
|
|
|
106
|
+
# Test root
|
|
107
|
+
fd = fs.get("/")
|
|
108
|
+
assert fd.is_dir()
|
|
109
|
+
assert stat.S_ISDIR(fd.mode)
|
|
110
|
+
|
|
96
111
|
# Test a small file
|
|
97
112
|
fd = fs.get("small")
|
|
98
113
|
_assert_is_file(fd, 5, FS3_ZeroLevelAddrType.FILE_DESCRIPTOR_RESIDENT)
|
|
@@ -111,11 +126,13 @@ def test_vmfs_content(path: str) -> None:
|
|
|
111
126
|
# Test a symlink
|
|
112
127
|
fd = fs.get("symlink")
|
|
113
128
|
assert fd.is_symlink()
|
|
129
|
+
assert stat.S_ISLNK(fd.mode)
|
|
114
130
|
assert fd.link == f"/vmfs/volumes/{fs.label}/small"
|
|
115
131
|
|
|
116
132
|
# Test a directory
|
|
117
133
|
fd = fs.get("directory")
|
|
118
134
|
assert fd.is_dir()
|
|
135
|
+
assert stat.S_ISDIR(fd.mode)
|
|
119
136
|
contents = fd.listdir()
|
|
120
137
|
|
|
121
138
|
assert set(contents.keys()) == {f"file{i}" for i in range(1, 101)} | {".", ".."}, (
|
|
@@ -213,5 +230,24 @@ def _assert_is_file(fd: vmfs.FileDescriptor, size: int, zla: FS3_ZeroLevelAddrTy
|
|
|
213
230
|
assert not fd.is_symlink()
|
|
214
231
|
assert not fd.is_rdm()
|
|
215
232
|
assert not fd.is_system()
|
|
233
|
+
assert stat.S_ISREG(fd.mode)
|
|
216
234
|
assert fd.size == size
|
|
217
235
|
assert fd.zla == zla
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@pytest.mark.parametrize(
|
|
239
|
+
("path"),
|
|
240
|
+
[
|
|
241
|
+
pytest.param("vmfs/zero5.bin.gz", id="vmfs5"),
|
|
242
|
+
pytest.param("vmfs/zero6.bin.gz", id="vmfs6"),
|
|
243
|
+
],
|
|
244
|
+
)
|
|
245
|
+
def test_sparse(path: str) -> None:
|
|
246
|
+
"""Test that an empty disk but with a valid ZLA is correctly interpreted as sparse."""
|
|
247
|
+
with gzip.open(absolute_path(f"_data/{path}"), "rb") as fh:
|
|
248
|
+
vs = lvm.LVM(fh)
|
|
249
|
+
fs = vmfs.VMFS(vs.volumes[0].open())
|
|
250
|
+
|
|
251
|
+
fd = fs.get("empty-flat.vmdk")
|
|
252
|
+
assert fd.zla == FS3_ZeroLevelAddrType.POINTER_BLOCK
|
|
253
|
+
assert fd.open().read(512) == b"\x00" * 512
|
|
@@ -4,7 +4,7 @@ envlist = lint, py3, pypy3
|
|
|
4
4
|
# requires if they are not available on the host system. This requires the
|
|
5
5
|
# locally installed tox to have a minimum version 3.3.0. This means the names
|
|
6
6
|
# of the configuration options are still according to the tox 3.x syntax.
|
|
7
|
-
minversion = 4.
|
|
7
|
+
minversion = 4.27.0
|
|
8
8
|
# This version of virtualenv will install setuptools version 68.2.2 and pip
|
|
9
9
|
# 23.3.1. These versions fully support python projects defined only through a
|
|
10
10
|
# pyproject.toml file (PEP-517/PEP-518/PEP-621). This pip version also support
|
|
@@ -14,9 +14,9 @@ requires = virtualenv>=20.24.6
|
|
|
14
14
|
[testenv]
|
|
15
15
|
extras = dev
|
|
16
16
|
deps =
|
|
17
|
-
pytest
|
|
18
17
|
pytest-cov
|
|
19
18
|
coverage
|
|
19
|
+
dependency_groups = test
|
|
20
20
|
commands =
|
|
21
21
|
pytest --basetemp="{envtmpdir}" {posargs:--color=yes --cov=dissect --cov-report=term-missing -v tests}
|
|
22
22
|
coverage report
|
|
@@ -24,26 +24,24 @@ commands =
|
|
|
24
24
|
|
|
25
25
|
[testenv:build]
|
|
26
26
|
package = skip
|
|
27
|
-
|
|
28
|
-
build
|
|
27
|
+
dependency_groups = build
|
|
29
28
|
commands =
|
|
30
29
|
pyproject-build
|
|
31
30
|
|
|
32
31
|
[testenv:fix]
|
|
33
32
|
package = skip
|
|
34
|
-
|
|
35
|
-
ruff==0.12.1
|
|
33
|
+
dependency_groups = lint
|
|
36
34
|
commands =
|
|
35
|
+
ruff check --fix dissect tests
|
|
37
36
|
ruff format dissect tests
|
|
38
37
|
|
|
39
38
|
[testenv:lint]
|
|
40
39
|
package = skip
|
|
41
|
-
|
|
42
|
-
ruff==0.12.1
|
|
43
|
-
vermin
|
|
40
|
+
dependency_groups = lint
|
|
44
41
|
commands =
|
|
45
42
|
ruff check dissect tests
|
|
46
|
-
|
|
43
|
+
ruff format --check dissect tests
|
|
44
|
+
vermin -t=3.10- --no-tips --lint dissect tests
|
|
47
45
|
|
|
48
46
|
[testenv:docs-build]
|
|
49
47
|
allowlist_externals = make
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs5-resource-optimized.bin.gz
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_vmfs-3.12.dev1 → dissect_vmfs-3.13}/tests/_data/vmfs/vmfs6-resource-optimized.bin.gz
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|