Skip to content

Commit fa63abb

Browse files
authored
Infer path of bootbanks (#255)
1 parent c403f87 commit fa63abb

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

acquire/acquire.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,24 +1639,26 @@ def _run(cls, target: Target, cli_args: argparse.Namespace, collector: Collector
16391639
"bootbank": "BOOTBANK1",
16401640
"altbootbank": "BOOTBANK2",
16411641
}
1642-
boot_fs = {}
1642+
boot_fs = [] # List of tuples of bootbank paths and volume names
16431643

16441644
for boot_dir, boot_vol in boot_dirs.items():
16451645
dir_path = target.fs.path(boot_dir)
16461646
if dir_path.is_symlink() and dir_path.exists():
16471647
dst = dir_path.readlink()
1648-
fs = dst.get().top.fs
1649-
boot_fs[fs] = boot_vol
1650-
1651-
for fs, mountpoint, uuid, _ in iter_esxi_filesystems(target):
1652-
if fs in boot_fs:
1653-
name = boot_fs[fs]
1654-
log.info("Acquiring %s (%s)", mountpoint, name)
1655-
mountpoint_len = len(mountpoint)
1656-
base = f"fs/{uuid}:{name}"
1657-
for path in target.fs.path(mountpoint).rglob("*"):
1658-
outpath = path.as_posix()[mountpoint_len:]
1659-
collector.collect_path(path, outpath=outpath, base=base)
1648+
boot_fs.append((dst, boot_vol))
1649+
1650+
for _, mountpoint, uuid, _ in iter_esxi_filesystems(target):
1651+
for bootbank_path, boot_vol in boot_fs:
1652+
# samefile fails on python 3.9 (https://github.com/fox-it/dissect.target/issues/1289)
1653+
# but support for 3.9 gets dropped soon
1654+
if bootbank_path.samefile(target.fs.path(mountpoint)):
1655+
log.info("Acquiring %s (%s)", mountpoint, boot_vol)
1656+
mountpoint_len = len(mountpoint)
1657+
base = f"fs/{uuid}:{boot_vol}"
1658+
for path in target.fs.path(mountpoint).rglob("*"):
1659+
outpath = path.as_posix()[mountpoint_len:]
1660+
collector.collect_path(path, outpath=outpath, base=base)
1661+
break
16601662

16611663

16621664
@register_module("--esxi")

0 commit comments

Comments
 (0)