Skip to content

Commit 8132bf7

Browse files
357384nMarshall-Hallenbeck
authored andcommitted
Update powershell_history.py
Add the path to output file in the output Signed-off-by: Sébastien Miguel <43112303+357384n@users.noreply.github.com>
1 parent 1105dcd commit 8132bf7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

nxc/modules/powershell_history.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class NXCModule:
1111
multiple_hosts = True
1212

1313
def options(self, context, module_options):
14-
"""Export all the history with -o export=enable"""
14+
"""Define module options."""
1515
context.log.info(f"Received module options: {module_options}")
1616
self.export = module_options.get('EXPORT', 'disable').lower()
1717
context.log.info(f"Option export set to: {self.export}")
@@ -36,7 +36,7 @@ def analyze_history(self, history):
3636
"password", "passwd", "secret", "credential", "key",
3737
"get-credential", "convertto-securestring", "set-localuser",
3838
"new-localuser", "set-adaccountpassword", "new-object system.net.webclient",
39-
"invoke-webrequest", "invoke-restmethod", "pass"
39+
"invoke-webrequest", "invoke-restmethod"
4040
]
4141
sensitive_commands = []
4242
for command in history:
@@ -72,6 +72,9 @@ def on_admin_login(self, context, connection):
7272
for cmd in history:
7373
file.write(cmd + "\n")
7474
context.log.info(f"History written to {filename}")
75+
# Print the full path to the file
76+
full_path = os.path.abspath(filename)
77+
print(f"PowerShell history written to: {full_path}")
7578
except Exception as e:
7679
context.log.fail(f"Failed to write history to {filename}: {e}")
7780

0 commit comments

Comments
 (0)