Skip to content

Commit

Permalink
Add --computers from smb to ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Mar 4, 2025
1 parent fc6e34e commit 0a5c1fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nxc/protocols/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
UF_TRUSTED_FOR_DELEGATION,
UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION,
UF_SERVER_TRUST_ACCOUNT,
SAM_MACHINE_ACCOUNT,
)
from impacket.krb5 import constants
from impacket.krb5.kerberosv5 import getKerberosTGS, SessionKeyDecryptionError
Expand Down Expand Up @@ -698,6 +699,15 @@ def groups(self):
self.logger.debug("Exception:", exc_info=True)
self.logger.debug(f"Skipping item, cannot process due to error {e}")

def computers(self):
resp = self.search(f"(sAMAccountType={SAM_MACHINE_ACCOUNT})", ["name"], 0)
resp_parse = parse_result_attributes(resp)

if resp:
self.logger.display(f"Total records returned: {len(resp_parse)}")
for item in resp_parse:
self.logger.highlight(item["name"] + "$")

def dc_list(self):
# Building the search filter
resolv = resolver.Resolver()
Expand Down
1 change: 1 addition & 0 deletions nxc/protocols/ldap/proto_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def proto_args(parser, parents):
vgroup.add_argument("--admin-count", action="store_true", help="Get objets that had the value adminCount=1")
vgroup.add_argument("--users", nargs="*", help="Enumerate enabled domain users")
vgroup.add_argument("--groups", nargs="?", const="", help="Enumerate domain groups, if a group is specified than its members are enumerated")
vgroup.add_argument("--computers", action="store_true", help="Enumerate domain computers")
vgroup.add_argument("--dc-list", action="store_true", help="Enumerate Domain Controllers")
vgroup.add_argument("--get-sid", action="store_true", help="Get domain sid")
vgroup.add_argument("--active-users", nargs="*", help="Get Active Domain Users Accounts")
Expand Down

0 comments on commit 0a5c1fd

Please sign in to comment.