Skip to content

Back to the Category Index / Back to the Command Index

Finds accounts that do not require pre-authentication through LDAP. It can also request AS-REPs and save them in a format for offline analysis.

ItemDetails
Implementationexamples/GetNPUsers.py
CategoryKerberos / Ticket Handling
Size411 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Check python examples/GetNPUsers.py -h for the current option definitions.

ArgumentDescription
target[[domain/]username[:password]]
-requestRequest TGTs for users and output them in JtR/hashcat format (default: false).
-outputfileFile for ciphertexts in JtR/hashcat format.
-formatFormat for saving the AS_REQ of users without pre-authentication (choices: hashcat, john; default: hashcat).
-usersfileFile with one user per line to test.
-tsAdd timestamps to log output.
-debugEnable debug logging.
-hashesNTLM hashes in LMHASH:NTHASH format.
-no-passSkip the password prompt (useful with -k).
-kUse Kerberos authentication. Read credentials from the ccache (KRB5CCNAME) based on the target; fall back to command-line credentials if none are valid.
-aesKey128- or 256-bit AES key for Kerberos authentication.
-dc-ipDomain controller IP address. Defaults to the domain (FQDN) in target.
-dc-hostDomain controller hostname. Defaults to the domain (FQDN) in the account parameter.
-ldaps / -use-ldapsUse LDAPS instead of LDAP.

The command connects to LDAP using a domain identity and selects users with UF_DONT_REQUIRE_PREAUTH. With -request, it builds an AS-REQ for each user, sends it to the KDC, and converts the encrypted part of the AS-REP to the chosen format. -usersfile skips the LDAP search and tries input names in order.

For ordinary accounts with Kerberos pre-authentication enabled, the client includes a timestamp encrypted with the user’s key in the AS-REQ. The KDC validates it before returning a TGT. For accounts with UF_DONT_REQUIRE_PREAUTH, the KDC can return an AS-REP without this proof, allowing the encrypted response part to be saved for offline verification. The command combines the directory search and KDC requests.

The LDAP path searches UAC flags and account state and lists candidate users. It builds an AS-REQ for each principal only when -request is set. The -usersfile path needs no LDAP read permission and queries the KDC directly for supplied principals. Responses differ for nonexistent users, required pre-authentication, and rate limits.

getTGT() decodes AS-REP/KRB-ERROR with ASN.1 and changes where it splits the ciphertext and how it formats output according to the enctype. Hashcat and John use different field orders and separators, so the same bytes cannot simply be converted to hex. Do not treat every KDC error as “target absent”; distinguish clock skew, unknown principals, and required pre-authentication.

SymbolLocationEntry Point for Tracing Behavior
GetUserNoPreAuth50__init__(), printTable(), getUnixTime(), getTGT(), outputTGT(), run(), request_users_file_TGTs(), request_multiple_TGTs()
ModuleMain Names Used
impacketversion
impacket.dcerpc.v5.samrUF_ACCOUNTDISABLE, UF_DONT_REQUIRE_PREAUTH
impacket.exampleslogger
impacket.examples.utilsldap_login, parse_identity
impacket.krb5constants
impacket.krb5.asn1AS_REP, AS_REQ, KERB_PA_PAC_REQUEST, KRB_ERROR, seq_set, seq_set_iter
impacket.krb5.kerberosv5KerberosError, sendReceive
impacket.krb5.typesKerberosTime, Principal
impacket.ldapldap, ldapasn1
Import NameDistribution PackageUsage / Declaration Status
pyasn1pyasn1Imported directly; declared dependency

Output, Side Effects, and Required Privileges

Section titled “Output, Side Effects, and Required Privileges”
  • Primarily queries and authentication attempts. Repeated runs can affect audit logs, account lockouts, and target load.
  • Depending on options, creates or updates a local file. Check how existing files are handled and the permissions on output containing secrets.
  • On failure, use protocol status to determine whether name resolution, connection, authentication, service state, or permissions stopped the operation.

This command uses krb5.asn1 / constants / kerberosv5 / types, pyasn1, and LDAP helpers. getTGT(), outputTGT(), and the methods for requesting multiple users mark the boundary between search and KDC I/O.