Skip to content

Commit 8892b6a

Browse files
committed
Fix winrm execution
1 parent c43a64c commit 8892b6a

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

nxc/connection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from datetime import datetime
2+
import os
13
import random
24
import sys
35
import contextlib
@@ -15,6 +17,7 @@
1517
from nxc.loaders.moduleloader import ModuleLoader
1618
from nxc.logger import nxc_logger, NXCAdapter
1719
from nxc.context import Context
20+
from nxc.paths import NXC_PATH
1821
from nxc.protocols.ldap.laps import laps_search
1922
from nxc.helpers.pfx import pfx_auth
2023

@@ -156,6 +159,11 @@ def __init__(self, args, db, target):
156159
self.local_ip = None
157160
self.dns_server = self.args.dns_server
158161

162+
# Construct the output file template using os.path.join for OS compatibility
163+
base_log_dir = os.path.join(os.path.expanduser(NXC_PATH), "logs")
164+
filename_pattern = f"{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-")
165+
self.output_file_template = os.path.join(base_log_dir, "{output_folder}", filename_pattern)
166+
159167
# DNS resolution
160168
dns_result = self.resolver(target)
161169
if dns_result:

nxc/modules/ntds-dump-raw.py

Lines changed: 1 addition & 1 deletion
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"]
21+
supported_protocols = ["smb", "winrm"]
2222

2323
files_full_location_to_extract = [
2424
"Windows/System32/config/SYSTEM",

nxc/protocols/smb.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ def enum_host_info(self):
255255
self.logger.debug(e)
256256

257257
self.os_arch = self.get_os_arch()
258-
# Construct the output file template using os.path.join for OS compatibility
259-
base_log_dir = os.path.join(os.path.expanduser(NXC_PATH), "logs")
260-
filename_pattern = f"{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-")
261-
self.output_file_template = os.path.join(base_log_dir, "{output_folder}", filename_pattern)
262258

263259
try:
264260
# DCs seem to want us to logoff first, windows workstations sometimes reset the connection

0 commit comments

Comments
 (0)