dissect.hypervisor 3.22.dev1__tar.gz → 3.22.dev2__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.
Files changed (71) hide show
  1. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/PKG-INFO +1 -1
  2. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/__init__.py +2 -0
  3. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/vmx.py +1 -7
  4. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/vmdk.py +1 -4
  5. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/exceptions.py +3 -0
  6. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/tools/vmtar.py +2 -0
  7. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/util/vmtar.py +2 -2
  8. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect.hypervisor.egg-info/PKG-INFO +1 -1
  9. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/pyproject.toml +20 -2
  10. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/_docs/conf.py +2 -0
  11. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_vmdk.py +1 -2
  12. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/.git-blame-ignore-revs +0 -0
  13. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/COPYRIGHT +0 -0
  14. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/LICENSE +0 -0
  15. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/MANIFEST.in +0 -0
  16. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/README.md +0 -0
  17. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/__init__.py +0 -0
  18. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/c_hyperv.py +0 -0
  19. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/hyperv.py +0 -0
  20. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/ovf.py +0 -0
  21. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/pvs.py +0 -0
  22. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/descriptor/vbox.py +0 -0
  23. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/__init__.py +0 -0
  24. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/asif.py +0 -0
  25. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_asif.py +0 -0
  26. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_asif.pyi +0 -0
  27. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_hdd.py +0 -0
  28. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_qcow2.py +0 -0
  29. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_qcow2.pyi +0 -0
  30. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_vdi.py +0 -0
  31. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_vdi.pyi +0 -0
  32. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_vhd.py +0 -0
  33. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_vhdx.py +0 -0
  34. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/c_vmdk.py +0 -0
  35. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/hdd.py +0 -0
  36. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/qcow2.py +0 -0
  37. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/vdi.py +0 -0
  38. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/vhd.py +0 -0
  39. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/disk/vhdx.py +0 -0
  40. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/tools/__init__.py +0 -0
  41. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/tools/envelope.py +0 -0
  42. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/util/__init__.py +0 -0
  43. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect/hypervisor/util/envelope.py +0 -0
  44. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect.hypervisor.egg-info/SOURCES.txt +0 -0
  45. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect.hypervisor.egg-info/dependency_links.txt +0 -0
  46. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect.hypervisor.egg-info/entry_points.txt +0 -0
  47. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect.hypervisor.egg-info/requires.txt +0 -0
  48. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/dissect.hypervisor.egg-info/top_level.txt +0 -0
  49. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/setup.cfg +0 -0
  50. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/__init__.py +0 -0
  51. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/_docs/Makefile +0 -0
  52. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/_docs/index.rst +0 -0
  53. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/_tools/disk/vdi/generate.sh +0 -0
  54. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/_util.py +0 -0
  55. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/descriptor/__init__.py +0 -0
  56. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/descriptor/test_hyperv.py +0 -0
  57. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/descriptor/test_ovf.py +0 -0
  58. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/descriptor/test_pvs.py +0 -0
  59. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/descriptor/test_vbox.py +0 -0
  60. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/descriptor/test_vmx.py +0 -0
  61. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/__init__.py +0 -0
  62. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_asif.py +0 -0
  63. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_hdd.py +0 -0
  64. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_qcow2.py +0 -0
  65. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_vdi.py +0 -0
  66. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_vhd.py +0 -0
  67. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/disk/test_vhdx.py +0 -0
  68. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/util/__init__.py +0 -0
  69. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/util/test_envelope.py +0 -0
  70. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tests/util/test_vmtar.py +0 -0
  71. {dissect_hypervisor-3.22.dev1 → dissect_hypervisor-3.22.dev2}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.hypervisor
3
- Version: 3.22.dev1
3
+ Version: 3.22.dev2
4
4
  Summary: A Dissect module implementing parsers for various hypervisor disk, backup and configuration files
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from dissect.hypervisor.descriptor import hyperv, ovf, pvs, vbox, vmx
2
4
  from dissect.hypervisor.disk import asif, hdd, qcow2, vdi, vhd, vhdx, vmdk
3
5
  from dissect.hypervisor.util import envelope, vmtar
@@ -101,7 +101,7 @@ class VMX:
101
101
  self.attr.update(**_parse_dictionary(decrypted.decode()))
102
102
 
103
103
  def disks(self) -> list[str]:
104
- """Return a list of paths to disk files"""
104
+ """Return a list of paths to disk files."""
105
105
  dev_classes = ("scsi", "sata", "ide", "nvme")
106
106
  devices = {}
107
107
 
@@ -179,7 +179,6 @@ class KeySafe:
179
179
  @classmethod
180
180
  def from_text(cls, text: str) -> KeySafe:
181
181
  """Parse a ``KeySafe`` from a string."""
182
-
183
182
  # Key safes are a list of key locators. It's a key locator string with a specific prefix
184
183
  identifier, _, remainder = text.partition("/")
185
184
  if identifier != "vmware:key":
@@ -262,7 +261,6 @@ def _parse_key_locator(locator_string: str) -> Pair | Phrase | list[Pair | Phras
262
261
 
263
262
  Interally called ``KeyLocator``.
264
263
  """
265
-
266
264
  identifier, _, remainder = locator_string.partition("/")
267
265
 
268
266
  if identifier == "list":
@@ -303,7 +301,6 @@ def _split_list(value: str) -> list[str]:
303
301
  Lists are wrapped by braces and separated by comma. They can contain nested lists/pairs,
304
302
  so we need to separate at the correct nest level.
305
303
  """
306
-
307
304
  if not (match := re.match(r"\((.+)\)", value)):
308
305
  raise ValueError("Invalid list string")
309
306
 
@@ -337,7 +334,6 @@ def _parse_crypto_dict(dict_string: str) -> dict[str, str]:
337
334
 
338
335
  Internally called ``CryptoDict``.
339
336
  """
340
-
341
337
  crypto_dict = {}
342
338
  for part in dict_string.split(":"):
343
339
  key, _, value = part.partition("=")
@@ -351,7 +347,6 @@ def _decrypt_hmac(key: bytes, data: bytes, digest: str) -> bytes:
351
347
  First 16 bytes of the ciphertext are the IV and the last N bytes are the HMAC digest.
352
348
  The cleartext is padded using PKCS#7.
353
349
  """
354
-
355
350
  digest, digest_size = HMAC_MAP[digest]
356
351
 
357
352
  iv, encrypted, mac = data[:16], data[16:-digest_size], data[-digest_size:]
@@ -374,7 +369,6 @@ def _create_cipher(key: bytes, iv: bytes) -> AES.CbcMode:
374
369
 
375
370
  Dynamic based on the available crypto module.
376
371
  """
377
-
378
372
  if HAS_PYSTANDALONE:
379
373
  if len(key) == 32:
380
374
  cipher = "aes-256-cbc"
@@ -29,9 +29,7 @@ log.setLevel(os.getenv("DISSECT_LOG_VMDK", "CRITICAL"))
29
29
 
30
30
  class VMDK(AlignedStream):
31
31
  def __init__(self, fh: BinaryIO | Path | str | list[BinaryIO | Path | str]):
32
- """
33
- Input can be a file handle to a Disk Descriptor file or a list of file handles to multiple VMDK files.
34
- """
32
+ """Input can be a file handle to a Disk Descriptor file or a list of file handles to multiple VMDK files."""
35
33
  fhs = [fh] if not isinstance(fh, list) else fh
36
34
 
37
35
  self.disks = []
@@ -462,7 +460,6 @@ class DiskDescriptor:
462
460
  Resources:
463
461
  - https://github.com/libyal/libvmdk/blob/main/documentation/VMWare%20Virtual%20Disk%20Format%20(VMDK).asciidoc
464
462
  """
465
-
466
463
  descriptor_settings = {}
467
464
  extents: list[ExtentDescriptor] = []
468
465
  disk_db = {}
@@ -1,3 +1,6 @@
1
+ from __future__ import annotations
2
+
3
+
1
4
  class Error(Exception):
2
5
  pass
3
6
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import tarfile
2
4
 
3
5
  from dissect.hypervisor.util import vmtar
@@ -62,12 +62,12 @@ class VisorTarFile(tarfile.TarFile):
62
62
  raise tarfile.TarError("visor currently only supports read mode")
63
63
 
64
64
  try:
65
- from gzip import GzipFile # noqa: PLC0415
65
+ from gzip import GzipFile
66
66
  except ImportError:
67
67
  raise tarfile.CompressionError("gzip module is not available") from None
68
68
 
69
69
  try:
70
- from lzma import LZMAError, LZMAFile # noqa: PLC0415
70
+ from lzma import LZMAError, LZMAFile
71
71
  except ImportError:
72
72
  raise tarfile.CompressionError("lzma module is not available") from None
73
73
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.hypervisor
3
- Version: 3.22.dev1
3
+ Version: 3.22.dev2
4
4
  Summary: A Dissect module implementing parsers for various hypervisor disk, backup and configuration files
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -105,7 +105,7 @@ select = [
105
105
  "SLOT",
106
106
  "SIM",
107
107
  "TID",
108
- "TCH",
108
+ "TC",
109
109
  "PTH",
110
110
  "PLC",
111
111
  "TRY",
@@ -113,8 +113,25 @@ select = [
113
113
  "PERF",
114
114
  "FURB",
115
115
  "RUF",
116
+ "D"
116
117
  ]
117
- ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM105", "TRY003"]
118
+ ignore = [
119
+ "E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM105", "TRY003", "PLC0415",
120
+ # Ignore some pydocstyle rules for now as they require a larger cleanup
121
+ "D1",
122
+ "D205",
123
+ "D301",
124
+ "D417",
125
+ # Seems bugged: https://github.com/astral-sh/ruff/issues/16824
126
+ "D402",
127
+ ]
128
+ future-annotations = true
129
+
130
+ [tool.ruff.lint.pydocstyle]
131
+ convention = "google"
132
+
133
+ [tool.ruff.lint.flake8-type-checking]
134
+ strict = true
118
135
 
119
136
  [tool.ruff.lint.per-file-ignores]
120
137
  "tests/_docs/**" = ["INP001"]
@@ -123,6 +140,7 @@ ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM1
123
140
  [tool.ruff.lint.isort]
124
141
  known-first-party = ["dissect.hypervisor"]
125
142
  known-third-party = ["dissect"]
143
+ required-imports = ["from __future__ import annotations"]
126
144
 
127
145
  [tool.setuptools.packages.find]
128
146
  include = ["dissect.*"]
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  project = "dissect.hypervisor"
2
4
 
3
5
  extensions = [
@@ -197,12 +197,11 @@ def test_vmdk_sesparse() -> None:
197
197
  ),
198
198
  )
199
199
  def test_vmdk_extent_description(extent_description: str, expected_extents: list[ExtentDescriptor]) -> None:
200
- """test if we correctly parse VMDK sparse and flat extent descriptions.
200
+ """Test if we correctly parse VMDK sparse and flat extent descriptions.
201
201
 
202
202
  Resources:
203
203
  - https://github.com/libyal/libvmdk/blob/main/documentation/VMWare%20Virtual%20Disk%20Format%20(VMDK).asciidoc#22-extent-descriptions
204
204
  """
205
-
206
205
  descriptor = DiskDescriptor.parse(extent_description)
207
206
  assert descriptor.extents == expected_extents
208
207