Skip to content

Back to the Category Index / Back to the Command Index

Requests a TGT using a password, NT hash, AES key, or keytab, and saves it to a ccache.

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

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

ArgumentDescription
identity[domain/]username[:password]
-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 identity.
-serviceRequest a service ticket directly through an AS-REQ.
-principalTypePrincipal type: NT_UNKNOWN, NT_PRINCIPAL, NT_SRV_INST, NT_SRV_HST, NT_SRV_XHST, NT_UID, NT_SMTP_NAME, NT_ENTERPRISE, NT_WELLKNOWN, NT_SRV_HST_DOMAIN, NT_MS_PRINCIPAL, NT_MS_PRINCIPAL_AND_ID, or NT_ENT_PRINCIPAL_AND_ID (default: NT_PRINCIPAL).

Related technology: AS-REQ/AS-REP, enctype selection, and key usages 1 and 3 in Kerberos.

The command parses the identity and principal type, converts credentials into a binary key, and calls getKerberosTGT(). On success, it passes the KDC response, cipher, and session key to logic equivalent to CCache.fromTGT(), then saves <principal>.ccache. -service can change the requested principal.

A TGT lets the client principal use the KDC’s Ticket Granting Service. run() chooses between the supplied password, LM/NT hashes, or AES key, converts the principal name type and domain into a Principal, and passes them to getKerberosTGT(). For passwords, the long-term key is derived using the salt and enctype in the KDC’s pre-authentication response.

After a successful AS exchange, the return values include the encoded AS-REP, the ticket’s cipher profile, and the client/KDC session key obtained by decrypting the AS-REP. The ticket itself is encrypted with the krbtgt key, so the client need not read its contents. Subsequent TGS-REQs use the ticket and session key together; saveTicket() serializes them as a ccache credential.

With -service, the AS-REQ requests a service other than the usual krbtgt/domain. -principalType affects how the KDC interprets the principal; it is not merely a display format. On failure, distinguish pre-authentication type mismatches, clock skew, salt/key mismatches, and unreachable KDCs. Do not leave an empty or corrupt ccache as a successful artifact.

SymbolLocationEntry Point for Tracing Behavior
GETTGT35__init__(), saveTicket(), run()
ModuleMain Names Used
impacketversion
impacket.exampleslogger
impacket.examples.utilsparse_identity
impacket.krb5.kerberosv5getKerberosTGT
impacket.krb5constants
impacket.krb5.typesPrincipal
impacket.krb5.ccacheCCache

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.kerberosv5 / types / constants and the shared identity parser. Since GETTGT.run() and saveTicket() form a small implementation, keep key selection separate from saving when adding authentication methods.