diff --git a/nxc/protocols/ldap.py b/nxc/protocols/ldap.py index 4d38e008..724c78fc 100644 --- a/nxc/protocols/ldap.py +++ b/nxc/protocols/ldap.py @@ -653,7 +653,7 @@ class ldap(connection): ------- None """ - if self.args.users is not None: + if self.args.users: self.logger.debug(f"Dumping users: {', '.join(self.args.users)}") search_filter = f"(|{''.join(f'(sAMAccountName={user})' for user in self.args.users)})" else: @@ -679,7 +679,7 @@ class ldap(connection): # We default attributes to blank strings if they don't exist in the dict self.logger.highlight(f"{user.get('sAMAccountName', ''):<30}{pwd_last_set:<20}{user.get('badPwdCount', ''):<9}{user.get('description', ''):<60}") users.append(user.get("sAMAccountName", "")) - if self.args.users_export is not None: + if self.args.users_export: self.logger.display(f"Writing {len(resp_parse):d} local users to {self.args.users_export}") with open(self.args.users_export, "w+") as file: file.writelines(f"{user}\n" for user in users) diff --git a/nxc/protocols/ldap/proto_args.py b/nxc/protocols/ldap/proto_args.py index ecf73980..1c007914 100644 --- a/nxc/protocols/ldap/proto_args.py +++ b/nxc/protocols/ldap/proto_args.py @@ -21,8 +21,8 @@ def proto_args(parser, parents): vgroup.add_argument("--trusted-for-delegation", action="store_true", help="Get the list of users and computers with flag TRUSTED_FOR_DELEGATION") vgroup.add_argument("--password-not-required", action="store_true", help="Get the list of users with flag PASSWD_NOTREQD") 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("--users-export", help="Output domain users to a file") + vgroup.add_argument("--users", nargs="*", help="Enumerate domain users") + vgroup.add_argument("--users-export", help="Enumerate domain users and export them to the specified file") 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")