dissect.hypervisor 3.16.dev2__tar.gz → 3.16.dev3__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_hypervisor-3.16.dev2/dissect.hypervisor.egg-info → dissect_hypervisor-3.16.dev3}/PKG-INFO +1 -1
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vmdk.py +33 -74
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3/dissect.hypervisor.egg-info}/PKG-INFO +1 -1
- dissect_hypervisor-3.16.dev3/tests/test_vmdk.py +20 -0
- dissect_hypervisor-3.16.dev2/tests/test_vmdk.py +0 -93
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/COPYRIGHT +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/LICENSE +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/MANIFEST.in +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/README.md +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/__init__.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/__init__.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/c_hyperv.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/hyperv.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/ovf.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/pvs.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/vbox.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/vmx.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/__init__.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_hdd.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_qcow2.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vdi.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vhd.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vhdx.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vmdk.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/hdd.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/qcow2.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vdi.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vhd.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vhdx.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/exceptions.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/tools/__init__.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/tools/envelope.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/util/__init__.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/util/envelope.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/util/vmtar.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect.hypervisor.egg-info/SOURCES.txt +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect.hypervisor.egg-info/dependency_links.txt +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect.hypervisor.egg-info/entry_points.txt +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect.hypervisor.egg-info/requires.txt +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect.hypervisor.egg-info/top_level.txt +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/pyproject.toml +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/setup.cfg +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/__init__.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/conftest.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/differencing.avhdx.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/dynamic.vhd.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/dynamic.vhdx.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/encrypted.vmx +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/encryption.info +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/expanding.hdd/DiskDescriptor.xml +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/expanding.hdd/expanding.hdd +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/expanding.hdd/expanding.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/fixed.vhd.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/fixed.vhdx.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/local.tgz.ve +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/plain.hdd/DiskDescriptor.xml +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/plain.hdd/plain.hdd +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/plain.hdd/plain.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/sesparse.vmdk.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/DiskDescriptor.xml +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd.1.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd.2.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd.3.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd.4.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd.5.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/test.VMRS +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/test.vgz +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/test.vmcx +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/docs/Makefile +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/docs/conf.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/docs/index.rst +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_envelope.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_hdd.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_hyperv.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_ovf.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_pvs.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_vbox.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_vhd.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_vhdx.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_vmtar.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/test_vmx.py +0 -0
- {dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tox.ini +0 -0
{dissect_hypervisor-3.16.dev2/dissect.hypervisor.egg-info → dissect_hypervisor-3.16.dev3}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dissect.hypervisor
|
|
3
|
-
Version: 3.16.
|
|
3
|
+
Version: 3.16.dev3
|
|
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: Affero General Public License v3
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vmdk.py
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
1
|
import ctypes
|
|
4
2
|
import io
|
|
5
3
|
import logging
|
|
@@ -7,7 +5,6 @@ import os
|
|
|
7
5
|
import textwrap
|
|
8
6
|
import zlib
|
|
9
7
|
from bisect import bisect_right
|
|
10
|
-
from dataclasses import dataclass
|
|
11
8
|
from functools import lru_cache
|
|
12
9
|
from pathlib import Path
|
|
13
10
|
|
|
@@ -62,13 +59,13 @@ class VMDK(AlignedStream):
|
|
|
62
59
|
if self.descriptor.attr["parentCID"] != "ffffffff":
|
|
63
60
|
self.parent = open_parent(path.parent, self.descriptor.attr["parentFileNameHint"])
|
|
64
61
|
|
|
65
|
-
for
|
|
66
|
-
if
|
|
67
|
-
sdisk_fh = path.with_name(
|
|
62
|
+
for _, size, extent_type, filename in self.descriptor.extents:
|
|
63
|
+
if extent_type in ["SPARSE", "VMFSSPARSE", "SESPARSE"]:
|
|
64
|
+
sdisk_fh = path.with_name(filename).open("rb")
|
|
68
65
|
self.disks.append(SparseDisk(sdisk_fh, parent=self.parent))
|
|
69
|
-
elif
|
|
70
|
-
rdisk_fh = path.with_name(
|
|
71
|
-
self.disks.append(RawDisk(rdisk_fh,
|
|
66
|
+
elif extent_type in ["VMFS", "FLAT"]:
|
|
67
|
+
rdisk_fh = path.with_name(filename).open("rb")
|
|
68
|
+
self.disks.append(RawDisk(rdisk_fh, size * SECTOR_SIZE))
|
|
72
69
|
|
|
73
70
|
elif magic in (COWD_MAGIC, VMDK_MAGIC, SESPARSE_MAGIC):
|
|
74
71
|
sparse_disk = SparseDisk(fh)
|
|
@@ -401,37 +398,8 @@ class SparseExtentHeader:
|
|
|
401
398
|
return getattr(self.hdr, attr)
|
|
402
399
|
|
|
403
400
|
|
|
404
|
-
@dataclass
|
|
405
|
-
class ExtentDescriptor:
|
|
406
|
-
access_mode: str
|
|
407
|
-
sectors: int
|
|
408
|
-
type: str
|
|
409
|
-
filename: str | None = None
|
|
410
|
-
start_sector: int | None = None
|
|
411
|
-
partition_uuid: str | None = None
|
|
412
|
-
device_identifier: str | None = None
|
|
413
|
-
|
|
414
|
-
def __post_init__(self) -> None:
|
|
415
|
-
self._raw = " ".join(map(str, [v for v in self.__dict__.values() if v is not None]))
|
|
416
|
-
self.sectors = int(self.sectors)
|
|
417
|
-
|
|
418
|
-
if self.filename:
|
|
419
|
-
self.filename = self.filename.strip('"')
|
|
420
|
-
|
|
421
|
-
if self.start_sector:
|
|
422
|
-
self.start_sector = int(self.start_sector)
|
|
423
|
-
|
|
424
|
-
def __repr__(self) -> str:
|
|
425
|
-
return f"<ExtentDescriptor {self._raw}>"
|
|
426
|
-
|
|
427
|
-
def __str__(self) -> str:
|
|
428
|
-
return self._raw
|
|
429
|
-
|
|
430
|
-
|
|
431
401
|
class DiskDescriptor:
|
|
432
|
-
def __init__(
|
|
433
|
-
self, attr: dict, extents: list[ExtentDescriptor], disk_db: dict, sectors: int, raw_config: str | None = None
|
|
434
|
-
):
|
|
402
|
+
def __init__(self, attr, extents, disk_db, sectors, raw_config=None):
|
|
435
403
|
self.attr = attr
|
|
436
404
|
self.extents = extents
|
|
437
405
|
self.ddb = disk_db
|
|
@@ -439,15 +407,9 @@ class DiskDescriptor:
|
|
|
439
407
|
self.raw = raw_config
|
|
440
408
|
|
|
441
409
|
@classmethod
|
|
442
|
-
def parse(cls, vmdk_config
|
|
443
|
-
"""Return :class:`DiskDescriptor` based on the provided ``vmdk_config``.
|
|
444
|
-
|
|
445
|
-
Resources:
|
|
446
|
-
- https://github.com/libyal/libvmdk/blob/main/documentation/VMWare%20Virtual%20Disk%20Format%20(VMDK).asciidoc
|
|
447
|
-
""" # noqa: E501
|
|
448
|
-
|
|
410
|
+
def parse(cls, vmdk_config):
|
|
449
411
|
descriptor_settings = {}
|
|
450
|
-
extents
|
|
412
|
+
extents = []
|
|
451
413
|
disk_db = {}
|
|
452
414
|
sectors = 0
|
|
453
415
|
|
|
@@ -458,16 +420,11 @@ class DiskDescriptor:
|
|
|
458
420
|
continue
|
|
459
421
|
|
|
460
422
|
if line.startswith("RW ") or line.startswith("RDONLY ") or line.startswith("NOACCESS "):
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
continue
|
|
467
|
-
|
|
468
|
-
extent = ExtentDescriptor(*parts)
|
|
469
|
-
sectors += extent.sectors
|
|
470
|
-
extents.append(extent)
|
|
423
|
+
access_type, size, extent_type, filename = line.split(" ", 3)
|
|
424
|
+
filename = filename.strip('"')
|
|
425
|
+
size = int(size)
|
|
426
|
+
sectors += size
|
|
427
|
+
extents.append([access_type, size, extent_type, filename])
|
|
471
428
|
continue
|
|
472
429
|
|
|
473
430
|
setting, _, value = line.partition("=")
|
|
@@ -481,33 +438,35 @@ class DiskDescriptor:
|
|
|
481
438
|
|
|
482
439
|
return cls(descriptor_settings, extents, disk_db, sectors, vmdk_config)
|
|
483
440
|
|
|
484
|
-
def __str__(self)
|
|
485
|
-
str_template =
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
{}
|
|
490
|
-
|
|
491
|
-
# Extent Description
|
|
492
|
-
{}
|
|
441
|
+
def __str__(self):
|
|
442
|
+
str_template = """\
|
|
443
|
+
# Disk DescriptorFile
|
|
444
|
+
version=1
|
|
445
|
+
{}
|
|
493
446
|
|
|
494
|
-
|
|
495
|
-
|
|
447
|
+
# Extent Description
|
|
448
|
+
{}
|
|
496
449
|
|
|
497
|
-
|
|
498
|
-
|
|
450
|
+
# The Disk Data Base
|
|
451
|
+
#DDB
|
|
499
452
|
|
|
453
|
+
{}"""
|
|
454
|
+
str_template = textwrap.dedent(str_template)
|
|
500
455
|
descriptor_settings = []
|
|
501
456
|
for setting, value in self.attr.items():
|
|
502
|
-
if setting
|
|
503
|
-
|
|
457
|
+
if setting == "version":
|
|
458
|
+
continue
|
|
459
|
+
descriptor_settings.append("{}={}".format(setting, value))
|
|
504
460
|
descriptor_settings = "\n".join(descriptor_settings)
|
|
505
461
|
|
|
506
|
-
extents =
|
|
462
|
+
extents = []
|
|
463
|
+
for access_type, size, extent_type, filename in self.extents:
|
|
464
|
+
extents.append('{} {} {} "{}"'.format(access_type, size, extent_type, filename))
|
|
465
|
+
extents = "\n".join(extents)
|
|
507
466
|
|
|
508
467
|
disk_db = []
|
|
509
468
|
for setting, value in self.ddb.items():
|
|
510
|
-
disk_db.append(
|
|
469
|
+
disk_db.append('{} = "{}"'.format(setting, value))
|
|
511
470
|
disk_db = "\n".join(disk_db)
|
|
512
471
|
|
|
513
472
|
return str_template.format(descriptor_settings, extents, disk_db)
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3/dissect.hypervisor.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dissect.hypervisor
|
|
3
|
-
Version: 3.16.
|
|
3
|
+
Version: 3.16.dev3
|
|
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: Affero General Public License v3
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from dissect.hypervisor.disk.c_vmdk import c_vmdk
|
|
2
|
+
from dissect.hypervisor.disk.vmdk import VMDK
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_vmdk_sesparse(sesparse_vmdk):
|
|
6
|
+
vmdk = VMDK(sesparse_vmdk)
|
|
7
|
+
|
|
8
|
+
disk = vmdk.disks[0]
|
|
9
|
+
|
|
10
|
+
assert disk.is_sesparse
|
|
11
|
+
assert disk._grain_directory_size == 0x20000
|
|
12
|
+
assert disk._grain_table_size == 0x1000
|
|
13
|
+
assert disk._grain_entry_type == c_vmdk.uint64
|
|
14
|
+
assert disk._grain_directory[0] == 0x1000000000000000
|
|
15
|
+
|
|
16
|
+
header = disk.header
|
|
17
|
+
assert header.magic == c_vmdk.SESPARSE_CONST_HEADER_MAGIC
|
|
18
|
+
assert header.version == 0x200000001
|
|
19
|
+
|
|
20
|
+
assert vmdk.read(0x1000000) == b"a" * 0x1000000
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
from dissect.hypervisor.disk.c_vmdk import c_vmdk
|
|
4
|
-
from dissect.hypervisor.disk.vmdk import VMDK, DiskDescriptor, ExtentDescriptor
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_vmdk_sesparse(sesparse_vmdk):
|
|
8
|
-
vmdk = VMDK(sesparse_vmdk)
|
|
9
|
-
|
|
10
|
-
disk = vmdk.disks[0]
|
|
11
|
-
|
|
12
|
-
assert disk.is_sesparse
|
|
13
|
-
assert disk._grain_directory_size == 0x20000
|
|
14
|
-
assert disk._grain_table_size == 0x1000
|
|
15
|
-
assert disk._grain_entry_type == c_vmdk.uint64
|
|
16
|
-
assert disk._grain_directory[0] == 0x1000000000000000
|
|
17
|
-
|
|
18
|
-
header = disk.header
|
|
19
|
-
assert header.magic == c_vmdk.SESPARSE_CONST_HEADER_MAGIC
|
|
20
|
-
assert header.version == 0x200000001
|
|
21
|
-
|
|
22
|
-
assert vmdk.read(0x1000000) == b"a" * 0x1000000
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@pytest.mark.parametrize(
|
|
26
|
-
"extent_description, expected_extents",
|
|
27
|
-
[
|
|
28
|
-
(
|
|
29
|
-
'RW 123456789 SPARSE "disk.vmdk"',
|
|
30
|
-
[
|
|
31
|
-
ExtentDescriptor(
|
|
32
|
-
access_mode="RW",
|
|
33
|
-
sectors=123456789,
|
|
34
|
-
type="SPARSE",
|
|
35
|
-
filename="disk.vmdk",
|
|
36
|
-
partition_uuid=None,
|
|
37
|
-
device_identifier=None,
|
|
38
|
-
),
|
|
39
|
-
],
|
|
40
|
-
),
|
|
41
|
-
(
|
|
42
|
-
'RW 123456789 FLAT "disk-flat.vmdk" 0',
|
|
43
|
-
[
|
|
44
|
-
ExtentDescriptor(
|
|
45
|
-
access_mode="RW",
|
|
46
|
-
sectors=123456789,
|
|
47
|
-
type="FLAT",
|
|
48
|
-
filename="disk-flat.vmdk",
|
|
49
|
-
start_sector=0,
|
|
50
|
-
partition_uuid=None,
|
|
51
|
-
device_identifier=None,
|
|
52
|
-
)
|
|
53
|
-
],
|
|
54
|
-
),
|
|
55
|
-
(
|
|
56
|
-
"RDONLY 0 ZERO",
|
|
57
|
-
[
|
|
58
|
-
ExtentDescriptor(
|
|
59
|
-
access_mode="RDONLY",
|
|
60
|
-
sectors=0,
|
|
61
|
-
type="ZERO",
|
|
62
|
-
),
|
|
63
|
-
],
|
|
64
|
-
),
|
|
65
|
-
(
|
|
66
|
-
'NOACCESS 123456789 SPARSE "disk-sparse.vmdk" 123 partition-uuid device-id',
|
|
67
|
-
[
|
|
68
|
-
ExtentDescriptor(
|
|
69
|
-
access_mode="NOACCESS",
|
|
70
|
-
sectors=123456789,
|
|
71
|
-
type="SPARSE",
|
|
72
|
-
filename="disk-sparse.vmdk",
|
|
73
|
-
start_sector=123,
|
|
74
|
-
partition_uuid="partition-uuid",
|
|
75
|
-
device_identifier="device-id",
|
|
76
|
-
),
|
|
77
|
-
],
|
|
78
|
-
),
|
|
79
|
-
("RW 1234567890", []),
|
|
80
|
-
('RDONLY "file.vmdk"', []),
|
|
81
|
-
("NOACCESS", []),
|
|
82
|
-
],
|
|
83
|
-
ids=("sparse", "flat", "zero", "sparse-ids", "bad-1", "bad-2", "bad-3"),
|
|
84
|
-
)
|
|
85
|
-
def test_vmdk_extent_description(extent_description: str, expected_extents: list) -> None:
|
|
86
|
-
"""test if we correctly parse VMDK sparse and flat extent descriptions.
|
|
87
|
-
|
|
88
|
-
Resources:
|
|
89
|
-
- https://github.com/libyal/libvmdk/blob/main/documentation/VMWare%20Virtual%20Disk%20Format%20(VMDK).asciidoc#22-extent-descriptions
|
|
90
|
-
""" # noqa: E501
|
|
91
|
-
|
|
92
|
-
descriptor = DiskDescriptor.parse(extent_description)
|
|
93
|
-
assert descriptor.extents == expected_extents
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/ovf.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/pvs.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/vbox.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/descriptor/vmx.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/__init__.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_hdd.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_qcow2.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vdi.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vhd.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vhdx.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/c_vmdk.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/hdd.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/qcow2.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vdi.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vhd.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/disk/vhdx.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/exceptions.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/tools/__init__.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/tools/envelope.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/util/__init__.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/util/envelope.py
RENAMED
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/dissect/hypervisor/util/vmtar.py
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
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/differencing.avhdx.gz
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/expanding.hdd/expanding.hdd
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/plain.hdd/plain.hdd
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_hypervisor-3.16.dev2 → dissect_hypervisor-3.16.dev3}/tests/data/split.hdd/split.hdd
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
|
|
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
|