|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from typing import TYPE_CHECKING |
| 4 | +from uuid import UUID |
| 5 | + |
| 6 | +from dissect.database.ese.ntds.objects.top import Top |
| 7 | + |
| 8 | +if TYPE_CHECKING: |
| 9 | + from dissect.database.ese.ntds.objects import Computer |
| 10 | + |
| 11 | + |
| 12 | +class MSFVERecoveryInformation(Top): |
| 13 | + """Represents a msFVE-RecoveryInformation object in the Active Directory. |
| 14 | +
|
| 15 | + References: |
| 16 | + - https://learn.microsoft.com/en-us/windows/win32/adschema/c-msfve-recoveryinformation |
| 17 | + """ |
| 18 | + |
| 19 | + __object_class__ = "msFVE-RecoveryInformation" |
| 20 | + |
| 21 | + @property |
| 22 | + def volume_guid(self) -> UUID: |
| 23 | + """Return the volume GUID associated with this recovery information.""" |
| 24 | + return UUID(bytes_le=self.get("msFVE-VolumeGuid")) |
| 25 | + |
| 26 | + @property |
| 27 | + def recovery_guid(self) -> UUID: |
| 28 | + """Return the recovery GUID associated with this recovery information.""" |
| 29 | + return UUID(bytes_le=self.get("msFVE-RecoveryGuid")) |
| 30 | + |
| 31 | + @property |
| 32 | + def recovery_password(self) -> str: |
| 33 | + """Return the recovery password associated with this recovery information.""" |
| 34 | + return self.get("msFVE-RecoveryPassword") |
| 35 | + |
| 36 | + @property |
| 37 | + def key_package(self) -> bytes | None: |
| 38 | + """Return the key package associated with this recovery information, if any.""" |
| 39 | + return self.get("msFVE-KeyPackage") |
| 40 | + |
| 41 | + def computer(self) -> Computer: |
| 42 | + """Return the computer object associated with this recovery information.""" |
| 43 | + if (parent := self.parent()) is None: |
| 44 | + raise ValueError("msFVE-RecoveryInformation object has no parent computer") |
| 45 | + return parent |
0 commit comments