From 34ebd5ad54018d8b76eef5e47428ebe354e40efe Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:52:07 +0200 Subject: [PATCH 1/3] Fix tmp PATH on windows --- nxc/modules/msol.py | 6 +++--- nxc/modules/scuffy.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nxc/modules/msol.py b/nxc/modules/msol.py index 0daa3e6e1..7d4d22f0d 100644 --- a/nxc/modules/msol.py +++ b/nxc/modules/msol.py @@ -3,7 +3,7 @@ # Based on the article : https://blog.xpnsec.com/azuread-connect-for-redteam/ from sys import exit from os import path -import sys +from nxc.paths import TMP_PATH from nxc.helpers.powershell import get_ps_script @@ -49,14 +49,14 @@ def exec_script(self, _, connection): def on_admin_login(self, context, connection): if self.use_embedded: - file_to_upload = "/tmp/msol.ps1" + file_to_upload =(f"{TMP_PATH}/msol.ps1") try: with open(file_to_upload, "w") as msol: msol.write(self.msol_embedded) except FileNotFoundError: context.log.fail(f"Impersonate file specified '{file_to_upload}' does not exist!") - sys.exit(1) + exit(1) else: if path.isfile(self.MSOL_PS1): diff --git a/nxc/modules/scuffy.py b/nxc/modules/scuffy.py index 900e25e6a..701995b27 100644 --- a/nxc/modules/scuffy.py +++ b/nxc/modules/scuffy.py @@ -1,5 +1,6 @@ import ntpath from sys import exit +from nxc.paths import TMP_PATH class NXCModule: @@ -44,7 +45,7 @@ def options(self, context, module_options): exit(1) self.scf_name = module_options["NAME"] - self.scf_path = f"/tmp/{self.scf_name}.scf" + self.scf_path = f"{TMP_PATH}/{self.scf_name}.scf" self.file_path = ntpath.join("\\", f"{self.scf_name}.scf") if not self.cleanup: From dbc67e5ef8170e03b29c94be5c994fac41344ea9 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Wed, 3 Apr 2024 11:05:07 -0400 Subject: [PATCH 2/3] Remove left over brackets --- nxc/modules/msol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nxc/modules/msol.py b/nxc/modules/msol.py index 7d4d22f0d..0a2b44ccf 100644 --- a/nxc/modules/msol.py +++ b/nxc/modules/msol.py @@ -49,7 +49,7 @@ def exec_script(self, _, connection): def on_admin_login(self, context, connection): if self.use_embedded: - file_to_upload =(f"{TMP_PATH}/msol.ps1") + file_to_upload = f"{TMP_PATH}/msol.ps1" try: with open(file_to_upload, "w") as msol: From 0a42ebb6ec56c78824bf106d9775a6c23806af90 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 4 Apr 2024 12:20:38 -0400 Subject: [PATCH 3/3] Add missing packages to spec file, fixing ldap and pso module --- netexec.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netexec.spec b/netexec.spec index d42488a14..67ff23459 100644 --- a/netexec.spec +++ b/netexec.spec @@ -38,6 +38,7 @@ a = Analysis( 'nxc.protocols.smb.smbspider', 'nxc.protocols.smb.passpol', 'nxc.protocols.mssql.mssqlexec', + 'nxc.parsers.ldap_results', 'nxc.helpers.bash', 'nxc.helpers.bloodhound', 'nxc.helpers.msada_guids', @@ -71,6 +72,7 @@ a = Analysis( 'dploot.lib.smb', 'pyasn1_modules.rfc5652', 'unicrypto.backends.pycryptodomex', + 'dateutil.relativedelta', 'sspilib.raw._text', ], hookspath=['./nxc/.hooks'],