diff --git a/nxc/modules/hyperv-host.py b/nxc/modules/hyperv-host.py index cde252c5..185eaab4 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: diff --git a/nxc/modules/maq.py b/nxc/modules/maq.py index 6ea5d44e..00e19628 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: ")