dissect.vmfs 3.12.dev1__py3-none-any.whl → 3.12.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.
@@ -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 NotAnRDMFileError, NotASymlinkError, VolumeNotAvailableError
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:
@@ -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.numLinks}, type {type_str}, flags {fd.flags:#x}, uid {fd.uid}, gid {fd.gid}, mode {fd.mode:o}
141
- len {fd.length}, nb {fd.numBlocks} tbz {fd.numTBZBlocksLo | fd.numTBZBlocksHi << 32}, cow {fd.numCOWBlocksLo | fd.numCOWBlocksHi << 32}, newSinceEpoch {fd.newSinceEpochLo | fd.newSinceEpochHi << 32}, zla {fd.zla}, bs {fd.blockSize}
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) == stat.S_IFDIR:
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.type == FS3_DescriptorType.SYMLINK:
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
- if self.type == FS3_DescriptorType.RDM:
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."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.vmfs
3
- Version: 3.12.dev1
3
+ Version: 3.12.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: Affero General Public License v3
@@ -4,15 +4,15 @@ dissect/vmfs/c_lvm.py,sha256=91TDxsXLuuQhrDkCuIfBp6Mk3swYvrvhQKYSDrd4NYw,8606
4
4
  dissect/vmfs/c_lvm.pyi,sha256=7zBVGF4dodM1RAQOGpIdPI8yY1LZdqa5xSe4cEsIsHE,10622
5
5
  dissect/vmfs/c_vmfs.py,sha256=ItKTgZbAo7RmUHqSAUm-9acXUmIb56byl4bGzuY8kc0,18643
6
6
  dissect/vmfs/c_vmfs.pyi,sha256=SjflR1Aeqip75Go1J3MdrIz_7SbWPGhaLmW5TPmLzs8,27787
7
- dissect/vmfs/descriptor.py,sha256=ShuTobdllKnYk6HV4Dc8gfPfb3K3y8WHqNgvzkDmODU,42230
7
+ dissect/vmfs/descriptor.py,sha256=HCA1wP97gu2OPdD8CL3GJpNl8zEKpSmTFt2guSkEJ6U,42527
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
10
  dissect/vmfs/resource.py,sha256=CzJSZyLZBs8vfcLjK1zuo5PjO0cR0AIPmxPbECgNFw4,19976
11
11
  dissect/vmfs/util.py,sha256=zNMIsOGRIiWMCBnajZk60YdxOOLxUgvQ3Ck4PTCfbaY,923
12
12
  dissect/vmfs/vmfs.py,sha256=q7rfVScJ40Wt_zGTnFkXgS7g3xvOWTbTrUypE-M0GvI,16324
13
- dissect_vmfs-3.12.dev1.dist-info/licenses/COPYRIGHT,sha256=xRsH_sojCCOLf87tua-LfCu1_G8XAFtQnrF-iJ9ZImk,299
14
- dissect_vmfs-3.12.dev1.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
15
- dissect_vmfs-3.12.dev1.dist-info/METADATA,sha256=oWnt2SNH9gvvsiNpR6N41xI0td33VlGIVF8rzUtUSTk,3250
16
- dissect_vmfs-3.12.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- dissect_vmfs-3.12.dev1.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
18
- dissect_vmfs-3.12.dev1.dist-info/RECORD,,
13
+ dissect_vmfs-3.12.dev2.dist-info/licenses/COPYRIGHT,sha256=xRsH_sojCCOLf87tua-LfCu1_G8XAFtQnrF-iJ9ZImk,299
14
+ dissect_vmfs-3.12.dev2.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
15
+ dissect_vmfs-3.12.dev2.dist-info/METADATA,sha256=vGtbAbuEiBWmNJrKozuI3j0GEDDz-QSjOJjiYVY7Nhc,3250
16
+ dissect_vmfs-3.12.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ dissect_vmfs-3.12.dev2.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
18
+ dissect_vmfs-3.12.dev2.dist-info/RECORD,,