config

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package config handles command-line flags, authentication, and runtime configuration for flashingestor.

Index

Constants

View Source
const DCERPC_EPM_TIMEOUT = 2 * time.Second // Timeout for DCE/RPC endpoint mapper
View Source
const DEFAULT_DNS_WORKERS = 10
View Source
const DEFAULT_LDAP_SCHEME = "ldaps"
View Source
const DEFAULT_LDAP_TIMEOUT = 30 * time.Second
View Source
const DEFAULT_REMOTE_COMPUTER_TIMEOUT = 10 * time.Second
View Source
const DEFAULT_REMOTE_METHOD_TIMEOUT = 4 * time.Second
View Source
const DEFAULT_REMOTE_WORKERS = 50
View Source
const DNS_DIAL_TIMEOUT = 5 * time.Second // Timeout for dialing to DNS server
View Source
const DNS_LOOKUP_TIMEOUT = 10 * time.Second // Timeout for DNS lookups
View Source
const HTTP_TIMEOUT = 3 * time.Second // Timeout for HTTP
View Source
const KERBEROS_TIMEOUT = 2 * time.Second // Timeout for Kerberos
View Source
const NETBIOS_TIMEOUT = 2 * time.Second // Timeout for NetBIOS
View Source
const PORTCHECK_TIMEOUT = 2 * time.Second // Generic timeout for port checking

Timeout constants for various network operations

View Source
const SMB_TIMEOUT = 2 * time.Second // Timeout for SMB

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DomainController      string
	OutputDir             string
	LogFile               string
	RemoteWorkers         int
	DNSWorkers            int
	RemoteComputerTimeout time.Duration
	RemoteMethodTimeout   time.Duration
	CustomDns             string
	DnsTcp                bool
	ConfigPath            string
	PprofEnabled          bool
	LdapAuthOptions       *ldapauth.Options
	RuntimeOptions        *RuntimeOptions

	IngestAuth       *CredentialMgr
	RemoteAuth       *CredentialMgr
	ChosenAuthIngest string
	ChosenAuthRemote string
	Resolver         *net.Resolver
}

Config holds all application configuration

func ParseFlags

func ParseFlags() (*Config, error)

ParseFlags parses command line flags and returns a configuration instance

type CredentialMgr

type CredentialMgr struct {
	// contains filtered or unexported fields
}

func NewCredentialMgr

func NewCredentialMgr(credential *adauth.Credential, useKerberos bool) *CredentialMgr

func ParseCredential

func ParseCredential(opts *adauth.Options, isEmptyPassword bool) (string, *CredentialMgr, error)

ParseCredential determines the authentication method based on provided options and returns a preliminary credential. It supports the following methods: [Via Kerberos] - User + Password - User + NTHash - User + AESKey - User + Certificate (PKINIT / Kerberos) ==> Certificate is either PFX or PEM/KEY pair - User + CCache ==> CCache is either from KRB5CCNAME or --ccache [Via regular methods] - User + Certificate (depends) - User + Password (NTLM) - User + NTHash (NTLM)

func (*CredentialMgr) Creds

func (a *CredentialMgr) Creds() *adauth.Credential

func (*CredentialMgr) Dialer

func (a *CredentialMgr) Dialer(timeout time.Duration) *net.Dialer

func (*CredentialMgr) Kerberos

func (a *CredentialMgr) Kerberos() bool

func (*CredentialMgr) NewTarget

func (a *CredentialMgr) NewTarget(protocol string, targetHost string) *adauth.Target

func (*CredentialMgr) Resolver

func (a *CredentialMgr) Resolver() *net.Resolver

func (*CredentialMgr) SetDC

func (a *CredentialMgr) SetDC(dc string)

type DialerWithResolver

type DialerWithResolver struct {
	Resolver *net.Resolver
}

DialerWithResolver implements custom LDAP dialing with DNS resolver override. TODO: Review if there's a better way (shouldn't ConnectTo respect my specified Resolver?)

func (*DialerWithResolver) Dial

func (d *DialerWithResolver) Dial(network, addr string) (net.Conn, error)

Dial implements the Dialer interface with a default context timeout.

func (*DialerWithResolver) DialContext

func (d *DialerWithResolver) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

DialContext resolves the address using the custom resolver and dials using TCP.

type QueryDefinition

type QueryDefinition struct {
	Name       string   `yaml:"name"`
	Filter     string   `yaml:"filter"`
	Attributes []string `yaml:"attributes"`
	PageSize   int      `yaml:"page_size"`
}

QueryDefinition represents a single LDAP query configuration

type RuntimeOptions

type RuntimeOptions struct {
	Common struct {
		Verbose int `yaml:"verbose"`
	} `yaml:"common"`

	Ingestion struct {
		RecurseTrusts          bool              `yaml:"recurse_trusts"`
		RecurseFeasibleOnly    bool              `yaml:"recurse_feasible_only"`
		IncludeACLs            bool              `yaml:"include_acls"`
		SearchForest           bool              `yaml:"search_forest"`
		LdapsToLdapFallback    bool              `yaml:"ldaps_to_ldap_fallback"`
		PromptMsgpackOverwrite bool              `yaml:"prompt_msgpack_overwrite"`
		AppendForestDomains    bool              `yaml:"append_forest_domains"`
		Queries                []QueryDefinition `yaml:"queries"`
	} `yaml:"ingestion"`

	RemoteCollection struct {
		Methods            []string `yaml:"methods"`
		AvailabilityChecks []string `yaml:"availability_checks"`
	} `yaml:"remote_collection"`

	Conversion struct {
		MergeRemote             bool `yaml:"merge_remote"`
		WriterBufsize           int  `yaml:"writer_bufsize"`
		CompressOutput          bool `yaml:"compress_output"`
		CleanupAfterCompression bool `yaml:"cleanup_after_compression"`
	} `yaml:"conversion"`
	// contains filtered or unexported fields
}

RuntimeOptions holds configurable runtime options that can be changed while running

func FallbackOptions

func FallbackOptions() *RuntimeOptions

FallbackOptions returns default runtime options

func LoadOptions

func LoadOptions(configPath string) (*RuntimeOptions, error)

LoadOptions loads options from a YAML file, or returns defaults if file doesn't exist

func (*RuntimeOptions) DisableMethod

func (opts *RuntimeOptions) DisableMethod(method string)

DisableMethod removes a specific collection method from the enabled list

func (*RuntimeOptions) GetAppendForestDomains

func (opts *RuntimeOptions) GetAppendForestDomains() bool

func (*RuntimeOptions) GetAvailabilityChecks added in v0.2.0

func (opts *RuntimeOptions) GetAvailabilityChecks() map[string]bool

GetAvailabilityChecks returns a map of availability checks to run Returns empty map if not configured (meaning no checks run)

func (*RuntimeOptions) GetCleanupAfterCompression

func (opts *RuntimeOptions) GetCleanupAfterCompression() bool

func (*RuntimeOptions) GetCompressOutput

func (opts *RuntimeOptions) GetCompressOutput() bool

func (*RuntimeOptions) GetEnabledMethods

func (opts *RuntimeOptions) GetEnabledMethods() []string

GetEnabledMethods returns a copy of the enabled methods list

func (*RuntimeOptions) GetIncludeACLs

func (opts *RuntimeOptions) GetIncludeACLs() bool

func (*RuntimeOptions) GetLdapsToLdapFallback

func (opts *RuntimeOptions) GetLdapsToLdapFallback() bool

func (*RuntimeOptions) GetMergeRemote

func (opts *RuntimeOptions) GetMergeRemote() bool

func (*RuntimeOptions) GetPromptMsgpackOverwrite

func (opts *RuntimeOptions) GetPromptMsgpackOverwrite() bool

func (*RuntimeOptions) GetQueries

func (opts *RuntimeOptions) GetQueries() []QueryDefinition

GetQueries returns a copy of the query definitions

func (*RuntimeOptions) GetRecurseFeasibleOnly

func (opts *RuntimeOptions) GetRecurseFeasibleOnly() bool

func (*RuntimeOptions) GetRecurseTrusts

func (opts *RuntimeOptions) GetRecurseTrusts() bool

func (*RuntimeOptions) GetSearchForest

func (opts *RuntimeOptions) GetSearchForest() bool

func (*RuntimeOptions) GetVerbose

func (opts *RuntimeOptions) GetVerbose() int

Thread-safe getters

func (*RuntimeOptions) GetWriterBufsize

func (opts *RuntimeOptions) GetWriterBufsize() int

func (*RuntimeOptions) IsMethodEnabled

func (opts *RuntimeOptions) IsMethodEnabled(method string) bool

IsMethodEnabled checks if a specific collection method is enabled

func (*RuntimeOptions) SaveOptions

func (opts *RuntimeOptions) SaveOptions(configPath string) error

SaveOptions saves current options to a YAML file

func (*RuntimeOptions) SetAppendForestDomains

func (opts *RuntimeOptions) SetAppendForestDomains(enabled bool)

func (*RuntimeOptions) SetAvailabilityChecks added in v0.2.0

func (opts *RuntimeOptions) SetAvailabilityChecks(checks []string)

func (*RuntimeOptions) SetCleanupAfterCompression

func (opts *RuntimeOptions) SetCleanupAfterCompression(enabled bool)

func (*RuntimeOptions) SetCompressOutput

func (opts *RuntimeOptions) SetCompressOutput(enabled bool)

func (*RuntimeOptions) SetIncludeACLs

func (opts *RuntimeOptions) SetIncludeACLs(enabled bool)

func (*RuntimeOptions) SetLdapsToLdapFallback

func (opts *RuntimeOptions) SetLdapsToLdapFallback(enabled bool)

func (*RuntimeOptions) SetMergeRemote

func (opts *RuntimeOptions) SetMergeRemote(enabled bool)

func (*RuntimeOptions) SetPromptMsgpackOverwrite

func (opts *RuntimeOptions) SetPromptMsgpackOverwrite(enabled bool)

func (*RuntimeOptions) SetRecurseTrusts

func (opts *RuntimeOptions) SetRecurseTrusts(enabled bool)

func (*RuntimeOptions) SetSearchForest

func (opts *RuntimeOptions) SetSearchForest(enabled bool)

func (*RuntimeOptions) SetVerbose

func (opts *RuntimeOptions) SetVerbose(level int)

Thread-safe setters

func (*RuntimeOptions) SetWriterBufsize

func (opts *RuntimeOptions) SetWriterBufsize(size int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL