-
Notifications
You must be signed in to change notification settings - Fork 31
pkg session
Jacob Paullus edited this page Apr 17, 2026
·
1 revision
The session package is the foundation for all tools. It parses Impacket-style target strings and manages authentication credentials.
type Credentials struct {
Domain string // e.g. "CORP.LOCAL"
Username string // e.g. "administrator"
Password string // e.g. "P@ssw0rd"
Hash string // NTLM hash, format "LMHASH:NTHASH" or ":NTHASH"
UseKerberos bool // Use Kerberos instead of NTLM
DCHost string // Domain controller hostname
DCIP string // Domain controller IP
AESKey string // AES key for Kerberos (hex)
Keytab string // Path to keytab file
}type Target struct {
Host string // Hostname or IP (e.g. "dc01.corp.local")
IP string // Connection IP if different from Host (for Kerberos DNS issues)
Port int // Target port (0 = tool default)
IPv6 bool // Prefer IPv6 connections
}Parses an Impacket-style target string into a Target and Credentials.
func ParseTargetString(input string) (Target, Credentials, error)Format: [domain/]user[:password]@target[:port]
The @ delimiter is split on the last @ in the string, allowing passwords containing @.
target, creds, err := session.ParseTargetString("CORP/admin:P@ss@dc01:445")
// creds.Domain = "CORP"
// creds.Username = "admin"
// creds.Password = "P@ss"
// target.Host = "dc01"
// target.Port = 445Prompts interactively for a password if one is not already set and no alternative authentication method (hash, Kerberos, etc.) is configured.
func EnsurePassword(creds *Credentials)Returns the connection address using net.JoinHostPort, correctly handling IPv6 addresses.
func (t Target) Addr() string
// "dc01:445" or "[::1]:445"Returns "tcp6" when IPv6 is requested, "tcp" otherwise.
func (t Target) Network() string