Skip to content

Commit

Permalink
Fallback mount sysvol to C: if not mounted to another drive letter (#671
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Schamper authored Apr 9, 2024
1 parent 52c4480 commit ab8104f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dissect/target/plugins/os/windows/_os.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import operator
import struct
from typing import Any, Iterator, Optional

Expand Down Expand Up @@ -77,6 +78,14 @@ def add_mounts(self) -> None:
self.target.log.warning("Failed to map drive letters")
self.target.log.debug("", exc_info=e)

# Fallback mount the sysvol to C: if we didn't manage to mount it to any other drive letter
if operator.countOf(self.target.fs.mounts.values(), self.target.fs.mounts["sysvol"]) == 1:
if "c:" not in self.target.fs.mounts:
self.target.log.debug("Unable to determine drive letter of sysvol, falling back to C:")
self.target.fs.mount("c:", self.target.fs.mounts["sysvol"])
else:
self.target.log.warning("Unknown drive letter for sysvol")

@export(property=True)
def hostname(self) -> Optional[str]:
key = "HKLM\\SYSTEM\\ControlSet001\\Control\\Computername\\Computername"
Expand Down

0 comments on commit ab8104f

Please sign in to comment.