Skip to content

Commit

Permalink
Fix maq module if ms-DS-MachineAccountQuota is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Sep 19, 2024
1 parent cea324c commit 6dbf14b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions nxc/modules/maq.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pyasn1.error import PyAsn1Error


class NXCModule:
"""
Expand All @@ -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: <not set>")

0 comments on commit 6dbf14b

Please sign in to comment.