From cea324c97b2c64e13f674259047a274a8e69c263 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 19 Sep 2024 16:40:04 -0400 Subject: [PATCH 1/2] Fix escape sequence --- nxc/modules/hyperv-host.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nxc/modules/hyperv-host.py b/nxc/modules/hyperv-host.py index cde252c54..185eaab42 100644 --- a/nxc/modules/hyperv-host.py +++ b/nxc/modules/hyperv-host.py @@ -22,7 +22,7 @@ def options(self, context, module_options): def on_admin_login(self, context, connection): self.context = context - path = "SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters" + path = "SOFTWARE\\Microsoft\\Virtual Machine\\Guest\\Parameters" key = "HostName" try: From 6dbf14b87f35590250ed5a895d794f8d40c66066 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 19 Sep 2024 16:55:35 -0400 Subject: [PATCH 2/2] Fix maq module if ms-DS-MachineAccountQuota is not set --- nxc/modules/maq.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nxc/modules/maq.py b/nxc/modules/maq.py index 6ea5d44e4..00e196284 100644 --- a/nxc/modules/maq.py +++ b/nxc/modules/maq.py @@ -1,3 +1,5 @@ +from pyasn1.error import PyAsn1Error + class NXCModule: """ @@ -21,9 +23,10 @@ def options(self, context, module_options): multiple_hosts = False def on_login(self, context, connection): - result = [] context.log.display("Getting the MachineAccountQuota") - searchFilter = "(objectClass=*)" - attributes = ["ms-DS-MachineAccountQuota"] - result = connection.search(searchFilter, attributes) - context.log.highlight("MachineAccountQuota: %d" % result[0]["attributes"][0]["vals"][0]) + result = connection.search("(objectClass=*)", ["ms-DS-MachineAccountQuota"]) + try: + maq = result[0]["attributes"][0]["vals"][0] + context.log.highlight(f"MachineAccountQuota: {maq}") + except PyAsn1Error: + context.log.highlight("MachineAccountQuota: ")