-
Notifications
You must be signed in to change notification settings - Fork 31
pkg flags
Jacob Paullus edited this page Apr 17, 2026
·
1 revision
The flags package provides standardized command-line flag parsing that mirrors Impacket's interface.
type Options struct {
// Authentication
Hashes string // -hashes LMHASH:NTHASH
NoPass bool // -no-pass
Kerberos bool // -k
AesKey string // -aesKey HEX
Keytab string // -keytab FILE
// Connection
DcHost string // -dc-host HOST
DcIP string // -dc-ip IP
TargetIP string // -target-ip IP
Port int // -port PORT (default: 445)
IPv6 bool // -6
// Utility
InputFile string // -inputfile FILE
OutputFile string // -outputfile FILE
Timestamp bool // -ts
Debug bool // -debug
// Positional
TargetStr string // First positional arg (target)
Arguments []string // Remaining positional args
}Registers all standard flags, parses os.Args, and returns the populated Options.
func Parse() *OptionsCopies parsed CLI flags into a Target and Credentials struct.
func (o *Options) ApplyToSession(target *session.Target, creds *session.Credentials)Handles -hashes, -k, -dc-ip, -dc-host, -target-ip, -port, -6, -aesKey, -keytab, and -no-pass.
Returns remaining positional arguments joined as a single string (useful for remote execution tools).
func (o *Options) Command() stringUse Go's flag package alongside flags.Parse():
import "flag"
var maxRid int
flag.IntVar(&maxRid, "maxRid", 4000, "Maximum RID to brute force")
// flags.Parse() calls flag.Parse() internally
opts := flags.Parse()import "gopacket/pkg/flags"
flags.ExtraUsageLine = "[maxRid]"
flags.ExtraUsageText = "\nPositional arguments:\n maxRid Maximum RID (default: 4000)\n"
opts := flags.Parse()