pkg/ldap - LDAP/LDAPS Client
LDAP client with support for password bind, NTLM hash bind, and Kerberos GSSAPI bind. Handles LDAP, LDAPS (implicit TLS), and STARTTLS.
Constructor
Connection
useTLS |
Port |
Behavior |
false |
389 (default) |
Plain LDAP |
true |
636 |
Implicit TLS (LDAPS) |
true |
389 |
STARTTLS upgrade |
Authentication
| Method |
Description |
Login() |
Auto-detect: Kerberos -> NTLM hash -> password |
LoginWithKerberos() |
Kerberos GSSAPI SASL bind |
LoginWithHash() |
NTLM hash bind |
LoginWithUser(username string) |
Simple or NTLM bind with specific username |
Login() checks credentials in priority order:
creds.UseKerberos -> Kerberos GSSAPI
creds.Hash != "" -> NTLM bind
- Default -> simple bind with password
Search Operations
Directory Operations
| Method |
Signature |
Description |
GetDefaultNamingContext |
() (string, error) |
Get root DN from RootDSE |
GetSchemaNamingContext |
() (string, error) |
Get schema DN from RootDSE |
Additional Methods
| File |
Methods |
Description |
operations.go |
Modify, Add, Delete |
Standard LDAP write operations |
delegation.go |
FindDelegation |
Delegation enumeration |
spnusers.go |
GetSPNUsers |
SPN user enumeration for Kerberoasting |
npusers.go |
GetNPUsers |
AS-REP roast target enumeration |
Example: Enumerate Domain Users