Documentation
¶
Index ¶
- func DecodePFX(pfxData []byte, password string) (privateKey any, cert *x509.Certificate, chain []*x509.Certificate, err error)
- func NewDebugFunc(enabled *bool, writer io.Writer, colored bool) func(string, ...any)
- type ContextDialer
- type Credential
- func (c *Credential) DC(ctx context.Context, protocol string) (*Target, error)
- func (c *Credential) ImpacketLogonName() string
- func (c *Credential) KerberosConfig(ctx context.Context) (*config.Config, error)
- func (c *Credential) LogonName() string
- func (c *Credential) LogonNameWithUpperCaseDomain() string
- func (c *Credential) SetDC(dc string)
- func (c *Credential) UPN() string
- type Dialer
- type Options
- func (opts *Options) Domain() string
- func (opts *Options) NoTarget() (*Credential, error)
- func (opts *Options) RegisterFlags(flagset *pflag.FlagSet)
- func (opts *Options) UPN() string
- func (opts *Options) Username() string
- func (opts *Options) WithDCTarget(ctx context.Context, protocol string) (*Credential, *Target, error)
- func (opts *Options) WithTarget(ctx context.Context, protocol string, target string) (*Credential, *Target, error)
- type Resolver
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePFX ¶ added in v0.5.1
func DecodePFX(pfxData []byte, password string) (privateKey any, cert *x509.Certificate, chain []*x509.Certificate, err error)
DecodePFX loads the private key, certificate and certificate chain from PFX bytes that may or may not be protected by a password.
Types ¶
type ContextDialer ¶ added in v0.2.1
type ContextDialer interface {
DialContext(ctx context.Context, net string, addr string) (net.Conn, error)
Dial(net string, addr string) (net.Conn, error)
}
func AsContextDialer ¶ added in v0.2.1
func AsContextDialer(d Dialer) ContextDialer
AsContextDialer converts a Dialer into a ContextDialer that either uses the dialer's DialContext method if implemented or it uses a DialContext method that simply calls Dial ignoring the context.
func DialerWithSOCKS5ProxyIfSet ¶ added in v0.2.1
func DialerWithSOCKS5ProxyIfSet(socks5Server string, forward *net.Dialer) ContextDialer
DialerWithSOCKS5ProxyIfSet returns a SOCKS5 dialer if socks5Server is not empty and it returns the forward dialer otherwise.
func SOCKS5Dialer ¶ added in v0.2.1
func SOCKS5Dialer( network string, address string, auth *proxy.Auth, forward *net.Dialer, ) ContextDialer
SOCKS5Dialer returns a SOCKS5 dialer.
type Credential ¶
type Credential struct {
// Username is the username without the domain.
Username string
// Password contains the users cleartext password if available.
Password string
// Domain holds the user's domain.
Domain string
// NTHash holds the user's NT hash or Kerberos RC4 key if available.
NTHash string
// AESKey holds the user's Kerberos AES128 or AES256 key if available.
AESKey string
// CCache contains the path to the user's CCache file.
CCache string
// ClientCert holds a client certificate for Kerberos or LDAP authentication if available.
ClientCert *x509.Certificate
// ClientCertKey holds the private key that corresponds to ClientCert.
ClientCertKey any
// CACerts holds CA certificates that were loaded alongside the ClientCert.
CACerts []*x509.Certificate
// PasswordIsEmptyString is true when an empty Password field should not be
// interpreted as a missing password but as a password that happens to be
// empty.
PasswordIsEmtpyString bool
// CCacheIsFromEnv indicates whether the CCache was set explicitly or
// implicitly through an environment variable.
CCacheIsFromEnv bool
// Resolver can be used to set an alternative DNS resolver. If empty,
// net.DefaultResolver is used.
Resolver Resolver
// contains filtered or unexported fields
}
Credential represents Active Directory credentials.
func CredentialFromPFX ¶
func CredentialFromPFX( username string, domain string, pfxFile string, pfxPassword string, ) (*Credential, error)
CredentialFromPFX creates a Credential structure for certificate-based authentication based on a PFX file.
func CredentialFromPFXBytes ¶
func CredentialFromPFXBytes( username string, domain string, pfxData []byte, pfxPassword string, ) (*Credential, error)
CredentialFromPFX creates a Credential structure for certificate-based authentication based on PFX data.
func (*Credential) ImpacketLogonName ¶
func (c *Credential) ImpacketLogonName() string
ImpacketLogonName is the Impacket-style logon name (domain/username).
func (*Credential) KerberosConfig ¶
KerberosConfig returns the Kerberos configuration for the credential's domain. For compatibility with other Kerberos libraries, see the `compat` package.
func (*Credential) LogonName ¶
func (c *Credential) LogonName() string
LogonName is the legacy logon name (domain\username).
func (*Credential) LogonNameWithUpperCaseDomain ¶
func (c *Credential) LogonNameWithUpperCaseDomain() string
LogonNameWithUpperCaseDomain is like LogonName with the domain capitalized for compatibility with the Kerberos library (DOMAIN\username).
func (*Credential) SetDC ¶
func (c *Credential) SetDC(dc string)
SetDC configures a specific domain controller for this credential.
func (*Credential) UPN ¶
func (c *Credential) UPN() string
UPN is the user principal name (username@domain). If the credential does not contain a domain, only the username is returned. If username and domain are empty, the UPN will be empty, too.