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: ")