dissect.vmfs 3.13.dev1__py3-none-any.whl → 3.13.dev2__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.
@@ -131,7 +131,7 @@ class FileDescriptor:
131
131
  type_str = {
132
132
  FS3_DescriptorType.DIRECTORY: "dir",
133
133
  FS3_DescriptorType.REGFILE: "reg",
134
- FS3_DescriptorType.SYSTEM: "sys",
134
+ FS3_DescriptorType.SYSFILE: "sys",
135
135
  FS3_DescriptorType.RDM: "rdm",
136
136
  }.get(self.type, "oth")
137
137
 
@@ -451,7 +451,8 @@ class FileDescriptor5(FileDescriptor):
451
451
  primary_num = block_num >> self.vmfs._ptr_block_num_shift
452
452
  secondary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
453
453
 
454
- block = self.blocks[primary_num]
454
+ if (block := self.blocks[primary_num]) == 0:
455
+ return 0
455
456
  pb_buf = self.vmfs.resources.read(block)
456
457
 
457
458
  return _get_uint32_index(pb_buf, secondary_num)
@@ -461,10 +462,12 @@ class FileDescriptor5(FileDescriptor):
461
462
  secondary_num = (block_num >> self.vmfs._ptr_block_num_shift) & ((1 << self.vmfs._ptr_block_num_shift) - 1)
462
463
  tertiary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
463
464
 
464
- block = self.blocks[primary_num]
465
+ if (block := self.blocks[primary_num]) == 0:
466
+ return 0
465
467
  pb_buf = self.vmfs.resources.read(block)
466
468
 
467
- block = _get_uint32_index(pb_buf, secondary_num)
469
+ if (block := _get_uint32_index(pb_buf, secondary_num)) == 0:
470
+ return 0
468
471
  pb_buf = self.vmfs.resources.read(block)
469
472
 
470
473
  return _get_uint32_index(pb_buf, tertiary_num)
@@ -482,7 +485,10 @@ class FileDescriptor5(FileDescriptor):
482
485
  if self.zla == FS3_ZeroLevelAddrType.FILE_DESCRIPTOR_RESIDENT:
483
486
  return self._resolve_resident_offset(offset), 0
484
487
 
485
- block = self._offset_to_block_address(offset)
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
+
486
492
  type = address_type(block)
487
493
 
488
494
  if resource := self.vmfs.resources.get(type):
@@ -718,7 +724,8 @@ class FileDescriptor6(FileDescriptor):
718
724
  primary_num = block_num >> self.vmfs._ptr_block_num_shift
719
725
  secondary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
720
726
 
721
- block = self.blocks[primary_num]
727
+ if (block := self.blocks[primary_num]) == 0:
728
+ return 0
722
729
 
723
730
  # Pointer block data can be stored in the .pbc.sf file itself, in .sbc.sf or as regular file block
724
731
  # Use the address type to figure it out
@@ -730,10 +737,12 @@ class FileDescriptor6(FileDescriptor):
730
737
  secondary_num = (block_num >> self.vmfs._ptr_block_num_shift) & ((1 << self.vmfs._ptr_block_num_shift) - 1)
731
738
  tertiary_num = block_num & ((1 << self.vmfs._ptr_block_num_shift) - 1)
732
739
 
733
- block = self.blocks[primary_num]
740
+ if (block := self.blocks[primary_num]) == 0:
741
+ return 0
734
742
  pb_buf = self.vmfs.resources.read(block)
735
743
 
736
- block = _get_uint64_index(pb_buf, secondary_num)
744
+ if (block := _get_uint64_index(pb_buf, secondary_num)) == 0:
745
+ return 0
737
746
  pb_buf = self.vmfs.resources.read(block)
738
747
 
739
748
  return _get_uint64_index(pb_buf, tertiary_num)
@@ -751,7 +760,9 @@ class FileDescriptor6(FileDescriptor):
751
760
  if self.zla == FS3_ZeroLevelAddrType.FILE_DESCRIPTOR_RESIDENT:
752
761
  return self._resolve_resident_offset(offset), 0
753
762
 
754
- block = self._offset_to_block_address(offset)
763
+ if (block := self._offset_to_block_address(offset)) == 0:
764
+ # Return early with a TBZ set for 0 blocks
765
+ return 0, 0xFF
755
766
  type = address_type(block)
756
767
 
757
768
  if resource := self.vmfs.resources.get(type):
@@ -970,7 +981,7 @@ class BlockStream(AlignedStream):
970
981
  Eventual file blocks can also differ between FB (filesystem block), SB (sub/small block) and
971
982
  LFB (large filesystem block).
972
983
 
973
- See :func:`_resolve_offset_vmfs5` and :func:`_resolve_offset_vmfs6` for more information on how
984
+ See :func:`FileDescriptor5._resolve_offset` and :func:`FileDescriptor6._resolve_offset` for more information on how
974
985
  to resolve offsets.
975
986
  """
976
987
 
dissect/vmfs/resource.py CHANGED
@@ -367,7 +367,9 @@ class ResourceManager:
367
367
  self.resources = {}
368
368
 
369
369
  def __repr__(self) -> str:
370
- return f"<ResourceManager {' '.join(RESOURCE_TYPE_ABBREVIATIONS[r] for r in self.resources)}>"
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.vmfs
3
- Version: 3.13.dev1
3
+ Version: 3.13.dev2
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
6
  License-Expression: AGPL-3.0-or-later
@@ -4,15 +4,15 @@ dissect/vmfs/c_lvm.py,sha256=91TDxsXLuuQhrDkCuIfBp6Mk3swYvrvhQKYSDrd4NYw,8606
4
4
  dissect/vmfs/c_lvm.pyi,sha256=Chgo0n6wA35Dq736OH5eA1bJ3fKkIuxrWHqMf4n-1HI,10593
5
5
  dissect/vmfs/c_vmfs.py,sha256=ItKTgZbAo7RmUHqSAUm-9acXUmIb56byl4bGzuY8kc0,18643
6
6
  dissect/vmfs/c_vmfs.pyi,sha256=FA2G_Bhx9amexOObHwj8I8W2YdgVOnCP54TyK3y0FP4,27758
7
- dissect/vmfs/descriptor.py,sha256=HCA1wP97gu2OPdD8CL3GJpNl8zEKpSmTFt2guSkEJ6U,42527
7
+ dissect/vmfs/descriptor.py,sha256=aTbwvBHz7HR2pfqlbaFs_W-BINXV6LSQgTLrlTTqOBA,42956
8
8
  dissect/vmfs/exception.py,sha256=KhtE9LF_JEf-ILS_eK-7qC2mdYrv66JyEdVbjUXU1wQ,394
9
9
  dissect/vmfs/lvm.py,sha256=Szwip5li2tUktP4YG9g4JyTnq_y_i28LK28-3jsjivE,18028
10
- dissect/vmfs/resource.py,sha256=CzJSZyLZBs8vfcLjK1zuo5PjO0cR0AIPmxPbECgNFw4,19976
10
+ dissect/vmfs/resource.py,sha256=lQtYIUQiyW6R6H66HN7aEELpufQ5SSdDpYKXPPG-kCk,20020
11
11
  dissect/vmfs/util.py,sha256=zNMIsOGRIiWMCBnajZk60YdxOOLxUgvQ3Ck4PTCfbaY,923
12
12
  dissect/vmfs/vmfs.py,sha256=q7rfVScJ40Wt_zGTnFkXgS7g3xvOWTbTrUypE-M0GvI,16324
13
- dissect_vmfs-3.13.dev1.dist-info/licenses/COPYRIGHT,sha256=xRsH_sojCCOLf87tua-LfCu1_G8XAFtQnrF-iJ9ZImk,299
14
- dissect_vmfs-3.13.dev1.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
15
- dissect_vmfs-3.13.dev1.dist-info/METADATA,sha256=CMGSF3hRLVXJounBfRgr_P5QJd_MfDAFAKCmBUkrTNo,3211
16
- dissect_vmfs-3.13.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- dissect_vmfs-3.13.dev1.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
18
- dissect_vmfs-3.13.dev1.dist-info/RECORD,,
13
+ dissect_vmfs-3.13.dev2.dist-info/licenses/COPYRIGHT,sha256=xRsH_sojCCOLf87tua-LfCu1_G8XAFtQnrF-iJ9ZImk,299
14
+ dissect_vmfs-3.13.dev2.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
15
+ dissect_vmfs-3.13.dev2.dist-info/METADATA,sha256=9T4gNMS91dxS9iDIFn867zfzTnd1K4aokmsBKnsnWCw,3211
16
+ dissect_vmfs-3.13.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ dissect_vmfs-3.13.dev2.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
18
+ dissect_vmfs-3.13.dev2.dist-info/RECORD,,