Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dissect/target/loaders/vbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ def detect(path: Path) -> bool:
return path.suffix.lower() == ".vbox"

def map(self, target: Target) -> None:
for disk in self.vbox.disks():
target.disks.add(container.open(self.base_path.joinpath(disk)))
for disk in self.vbox.hardware.disks:
target.disks.add(container.open(self.base_path.joinpath(disk.location)))
9 changes: 4 additions & 5 deletions dissect/target/plugins/child/virtualbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING

from defusedxml import ElementTree
from dissect.hypervisor.descriptor.vbox import VBox
from dissect.hypervisor.descriptor.vbox import NS

from dissect.target.exceptions import UnsupportedPluginError
from dissect.target.helpers.record import ChildTargetRecord
Expand Down Expand Up @@ -45,7 +45,6 @@ def __init__(self, target: Target):
def find_vms(self) -> Iterator[Path]:
"""Yield Oracle VirtualBox ``.vbox`` file(s) found on the target."""
seen = set()

for user_details in self.target.user_details.all_with_home():
# Yield `.vbox` from default locations and add to seen.
for default_path in self.DEFAULT_PATHS:
Expand All @@ -70,7 +69,7 @@ def find_vms(self) -> Iterator[Path]:
continue

# Parse MachineEntries
for machine in config.findall(f".//{VBox.VBOX_XML_NAMESPACE}MachineEntry"):
for machine in config.findall(f".//{NS}MachineEntry"):
if (
(src := machine.get("src"))
and (src_path := self.target.fs.path(src)).exists()
Expand All @@ -80,7 +79,7 @@ def find_vms(self) -> Iterator[Path]:
yield src_path

# Glob for SystemProperties defaultMachineFolder
for system_properties in config.findall(f".//{VBox.VBOX_XML_NAMESPACE}SystemProperties"):
for system_properties in config.findall(f".//{NS}SystemProperties"):
if (folder_str := system_properties.get("defaultMachineFolder")) and (
folder_dir := self.target.fs.path(folder_str)
).is_dir():
Expand All @@ -97,7 +96,7 @@ def list_children(self) -> Iterator[ChildTargetRecord]:
for vbox in self.vboxes:
try:
config = ElementTree.fromstring(vbox.read_bytes())
name = config.find(f".//{VBox.VBOX_XML_NAMESPACE}Machine").attrib["name"]
name = config.find(f".//{NS}Machine").attrib["name"]
except Exception as e:
self.target.log.error("Failed to parse name from VirtualBox XML: %s", vbox) # noqa: TRY400
self.target.log.debug("", exc_info=e)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"dissect.database>=1.1.dev3,<2", # TODO: update on release!
"dissect.eventlog>=3,<4",
"dissect.evidence>=3.13.dev2,<4", # TODO: update on release!
"dissect.hypervisor>=3.20,<4",
"dissect.hypervisor>=3.21.dev3,<4", # TODO: update on release!
"dissect.ntfs>=3.16.dev,<4",
"dissect.regf>=3.13,<4",
"dissect.util>=3,<4",
Expand Down Expand Up @@ -93,7 +93,7 @@ dev = [
"dissect.fat[dev]>=3.0.dev,<4.0.dev",
"dissect.ffs[dev]>=3.0.dev,<4.0.dev",
"dissect.fve[dev]>=4.5.dev,<5.0.dev",
"dissect.hypervisor[dev]>=3.20.dev,<4.0.dev",
"dissect.hypervisor[dev]>=3.21.dev3,<4.0.dev", # TODO: update on release!
"dissect.jffs[dev]>=1.5.dev,<2.0.dev",
"dissect.ntfs[dev]>=3.16.dev,<4.0.dev",
"dissect.qnxfs[dev]>=1.1.dev,<2.0.dev",
Expand Down
6 changes: 3 additions & 3 deletions tests/loaders/test_vbox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from unittest.mock import patch
from unittest.mock import Mock, patch

import pytest

Expand Down Expand Up @@ -32,7 +32,7 @@ def test_target_open(opener: Callable[[str | Path], Target], tmp_path: Path) ->
patch("dissect.target.target.Target.apply"),
):
mock_vbox.return_value = mock_vbox
mock_vbox.disks.return_value = ["mock.vdi"]
mock_vbox.hardware.disks = [Mock(location="mock.vdi")]

target = opener(path)
assert isinstance(target._loader, VBoxLoader)
Expand All @@ -48,7 +48,7 @@ def test_loader(tmp_path: Path) -> None:
patch("dissect.target.container.open") as mock_container_open,
):
mock_vbox.return_value = mock_vbox
mock_vbox.disks.return_value = ["mock.vdi"]
mock_vbox.hardware.disks = [Mock(location="mock.vdi")]

loader = loader_open(path)
assert isinstance(loader, VBoxLoader)
Expand Down
Loading