config

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderOpenAI    = "openai"
	ProviderAnthropic = "anthropic"
)

Wire protocols aiscan speaks to LLM endpoints.

View Source
const DefaultConfigName = "aiscan.yaml"

Variables

View Source
var (
	DefaultProvider = "openai"
	DefaultBaseURL  = ""
	DefaultAPIKey   = ""
	DefaultModel    = ""

	DefaultScannerProxy = ""

	DefaultCyberhubURL  = ""
	DefaultCyberhubKey  = ""
	DefaultCyberhubMode = "merge"

	DefaultVerify = "auto"

	DefaultIOAURL      = ""
	DefaultIOANodeID   = ""
	DefaultIOANodeName = ""
	DefaultSpace       = ""

	DefaultTavilyKeys = ""
)
View Source
var Version = "dev"

Functions

func ActiveLLMProvider added in v0.4.0

func ActiveLLMProvider(llm *types.LLMConfig) *types.LLMProviderConfig

ActiveLLMProvider returns the selected LLM profile, or the first when the active id is missing/unknown, or nil when no profiles exist.

func ApplyDefaults

func ApplyDefaults(option *Option)

func ApplySelectedSkills

func ApplySelectedSkills(text string, selected []string, store *skills.Store) (string, error)

func CLICommandSummary

func CLICommandSummary() string

func DataDir

func DataDir() string

DataDir returns the resolved .aiscan data directory. Priority is resolved centrally before this function is called: CLI > AISCAN_DATA_DIR > config > <binary_dir>/.aiscan.

func DataSubDir

func DataSubDir(sub string) string

DataSubDir returns a subdirectory under DataDir, creating it if needed.

func FormatInputs

func FormatInputs(inputs []string) string

func HasAgentOneShotInput

func HasAgentOneShotInput(opt *Option) bool

func InferProviderFromBaseURL added in v0.4.0

func InferProviderFromBaseURL(baseURL string) string

InferProviderFromBaseURL guesses the wire protocol from the base URL when no provider is set. The official Anthropic endpoint is unambiguous; everything else speaks the OpenAI protocol in the common case. A wrong guess is caught later as an actionable 404 from the provider, not a silent failure.

func InitDefaultConfig

func InitDefaultConfig() string

func IsScannerHelpRequest

func IsScannerHelpRequest(args []string) bool

func IsSupportedProvider added in v0.4.0

func IsSupportedProvider(name string) bool

IsSupportedProvider reports whether name is a usable provider value: a wire protocol or a known vendor alias.

func LoadAndApplyConfig

func LoadAndApplyConfig(option *Option) (string, error)

func LoadConfig

func LoadConfig(filename string, v interface{}) error

func LoadDistributeConfigYAML added in v0.4.0

func LoadDistributeConfigYAML(data []byte) (*types.DistributeConfig, error)

LoadDistributeConfigYAML parses an aiscan.yaml file into the canonical proto representation. It bridges YAML's snake-case keys with the proto message.

func MarshalDistributeConfigYAML added in v0.4.0

func MarshalDistributeConfigYAML(pb *types.DistributeConfig) ([]byte, error)

MarshalDistributeConfigYAML serializes the canonical proto config to YAML.

func NormalizeLLMConfig added in v0.4.0

func NormalizeLLMConfig(llm *types.LLMConfig)

NormalizeLLMConfig canonicalizes the final profile-list representation. Old flat LLM configuration is intentionally not accepted.

func NormalizeLLMProvider added in v0.4.0

func NormalizeLLMProvider(profile *types.LLMProviderConfig) *types.LLMProviderConfig

NormalizeLLMProvider trims and canonicalizes the provider protocol, inferring it from the base URL when blank.

func NormalizeProvider added in v0.4.0

func NormalizeProvider(name string) string

NormalizeProvider lowercases and trims a provider name.

func ProtocolOf added in v0.4.0

func ProtocolOf(name string) string

ProtocolOf maps a provider name — a wire protocol or a known OpenAI-compatible vendor — to the protocol spoken on the wire. Unknown names yield "".

func ProviderBaseURL added in v0.4.0

func ProviderBaseURL(name string) string

ProviderBaseURL returns the endpoint for a provider name with no explicit base_url: the vendor alias endpoint, or the protocol's official one. "" for unknown names.

func ResolveAgentServerURLs added in v0.4.0

func ResolveAgentServerURLs(option *Option) error

ResolveAgentServerURLs validates the Web/AOP endpoint. IOA remains independently configurable and falls back to the Web server's same-origin /ioa endpoint when omitted.

func ResolvePrompt added in v0.4.0

func ResolvePrompt(value string) (string, error)

ResolvePrompt treats a non-empty prompt as a file path when it names an existing regular file. Values that do not name a file remain natural language prompts.

func ResolveRuntimeConfig

func ResolveRuntimeConfig(option *Option, applyProcessState bool) (string, error)

ResolveRuntimeConfig resolves parsed configuration with environment and defaults.

func ResolveString

func ResolveString(value, fallback string) string

func ResolveTask

func ResolveTask(opt *Option) (string, error)

func ScannerCommandAvailable

func ScannerCommandAvailable(name string) bool

func ScannerUsageLines

func ScannerUsageLines() string

func SetDataDir

func SetDataDir(dir string)

SetDataDir sets the data directory explicitly (from -c/config). Must be called before any DataDir() call (typically during config resolution).

func StaticScannerUsage

func StaticScannerUsage(name string) (string, bool)

func StdinIsTerminal

func StdinIsTerminal() bool

Types

type AgentOptions

type AgentOptions struct {
	Prompt                string   `short:"p" long:"prompt" description:"Natural language task or existing file path for the agent"`
	Inputs                []string `short:"i" long:"input" description:"Target input: IP, URL, IP:port, or CIDR. Can specify multiple"`
	Skills                []string `short:"s" long:"skill" description:"Skill to apply (name or file path). Can specify multiple"`
	Tools                 []string `short:"t" long:"tools" config:"tools" description:"Optional tool groups to enable. Arsenal is always loaded"`
	TaskFile              string   `long:"task-file" description:"File containing task description"`
	Heartbeat             int      `` /* 132-byte string literal not displayed */
	Timeout               int      `long:"timeout" config:"timeout" description:"Overall timeout in seconds" default:"3600"`
	EvalCriteria          string   `` /* 146-byte string literal not displayed */
	EvalModel             string   `long:"eval-model" config:"eval_model" description:"Model for goal evaluation (defaults to main model)"`
	EvalMaxRetries        int      `long:"eval-retries" config:"eval_retries" description:"Max goal evaluation retry rounds" default:"3"`
	ServerURL             string   `long:"server-url" config:"server_url" description:"AIScan Web server URL for AOP, remote REPL and PTY access"`
	Transport             string   `long:"transport" config:"transport" description:"Agent transport: auto, local, web, or stdio" default:"auto"`
	Resume                string   `short:"r" long:"resume" description:"Resume agent context from an AOP JSONL session file"`
	SaveSession           bool     `long:"save-session" config:"save_session" description:"Auto-select a .aiscan/sessions/*.jsonl recording path"`
	CaptureProviderFrames bool     `` /* 145-byte string literal not displayed */
}

type AgentTransport added in v0.4.0

type AgentTransport string
const (
	AgentTransportAuto  AgentTransport = "auto"
	AgentTransportLocal AgentTransport = "local"
	AgentTransportWeb   AgentTransport = "web"
	AgentTransportStdio AgentTransport = "stdio"
)

func ResolveAgentTransport added in v0.4.0

func ResolveAgentTransport(opt *Option) (AgentTransport, error)

type IOAClientArgs

type IOAClientArgs struct {
	Space     string
	MessageID string
}

type IOAOptions

type IOAOptions struct {
	IOAURL      string `long:"ioa-url" config:"url" description:"Optional independent IOA URL (defaults to <server-url>/ioa for Web agents)"`
	IOAToken    string `long:"server-token" config:"token" description:"Server access key (auto-generated if empty)"`
	IOANodeID   string `long:"node-id" description:"Existing node id for agent tools"`
	IOANodeName string `long:"node-name" config:"node_name" description:"Node name when auto-registering"`
	Space       string `long:"space" config:"space" description:"Space name" default:"default"`
	IOAJSON     bool   `long:"json" description:"Output query results in JSON format"`
}

type LLMOptions

type LLMOptions struct {
	Provider      string             `long:"provider" config:"provider" description:"LLM protocol: openai (OpenAI-compatible, default) or anthropic"`
	BaseURL       string             `long:"base-url" config:"base_url" description:"LLM API base URL (leave empty to use provider default)"`
	APIKey        string             `long:"api-key" config:"api_key" description:"LLM API key (or env: OPENAI_API_KEY, ANTHROPIC_API_KEY, AISCAN_API_KEY)"`
	Model         string             `long:"model" config:"model" description:"LLM model name"`
	MaxTokens     int                `long:"max-tokens" config:"max_tokens" description:"Maximum output tokens per LLM response"`
	ContextWindow int                `long:"context-window" config:"context_window" description:"Explicit model context window in tokens"`
	LLMProxy      string             `long:"llm-proxy" config:"proxy" description:"Proxy for LLM API requests"`
	ActiveProfile string             `no-flag:"true" config:"active_profile" description:"Active named LLM profile"`
	Providers     []LLMProviderEntry `no-flag:"true" config:"providers" description:"Configured LLM provider profiles"`
	AI            bool               `long:"ai" description:"Analyze direct scanner output with an LLM"`
}

type LLMProviderEntry

type LLMProviderEntry struct {
	ID            string `config:"id" yaml:"id,omitempty"`
	Name          string `config:"name" yaml:"name,omitempty"`
	Provider      string `config:"provider" yaml:"provider"`
	BaseURL       string `config:"base_url" yaml:"base_url"`
	APIKey        string `config:"api_key" yaml:"api_key"`
	Model         string `config:"model" yaml:"model"`
	Proxy         string `config:"proxy" yaml:"proxy"`
	Timeout       int    `config:"timeout" yaml:"timeout"`
	Images        *bool  `config:"images" yaml:"images,omitempty"`
	MaxTokens     int    `config:"max_tokens" yaml:"max_tokens,omitempty"`
	ContextWindow int    `config:"context_window" yaml:"context_window,omitempty"`
}

type MiscOptions

type MiscOptions struct {
	ConfigFile string `short:"c" long:"config" description:"Path to config file (default: ./aiscan.yaml, <binary_dir>/aiscan.yaml)"`
	DataDir    string `long:"data-dir" config:"data_dir" description:"Data directory for cache, arsenal, history (default: <binary_dir>/.aiscan)"`
	InitConfig bool   `long:"init" description:"Generate default aiscan.yaml and exit"`
	ViewFile   string `short:"F" long:"view" description:"View an AOP event JSONL file"`
	ViewFormat string `short:"o" long:"output" description:"Output format for -F: terminal (default), markdown" default:"terminal"`
	OutputFile string `short:"f" long:"file" description:"Write scan and agent events to a streaming JSONL file (with -F: write rendered output)"`
	Debug      bool   `long:"debug" config:"debug" description:"Enable debug logging"`
	Verbose    []bool `short:"v" long:"verbose" description:"Increase verbosity (-v thinking and tool previews, -vv full tool results)"`
	Quiet      bool   `short:"q" long:"quiet" config:"quiet" description:"Quiet mode — only show final result"`
	NoColor    bool   `long:"no-color" config:"no_color" description:"Disable ANSI colors in scanner output"`
	Version    bool   `long:"version" description:"Print version and exit"`
}

type Option

type Option struct {
	LLMOptions     `group:"LLM Options" config:"llm"`
	ScannerOptions `group:"Scanner Options" config:"cyberhub"`
	AgentOptions   `group:"Agent Options" config:"agent"`
	IOAOptions     `group:"Server Options" config:"ioa"`
	ReconOptions   `group:"Recon Options" config:"recon"`
	OutputOptions  `group:"Output Options" config:"output"`
	MiscOptions    `group:"Miscellaneous Options" config:"misc"`
	ScanConfig     ScanConfigOptions   `no-flag:"true" config:"scan"`
	SearchConfig   SearchConfigOptions `no-flag:"true" config:"search"`

	// Runtime-only environment settings. Business packages receive these values
	// after ResolveRuntimeConfig instead of reading the process environment.
	RenderMode         string            `no-flag:"true"`
	REPLMode           string            `no-flag:"true"`
	PlaywrightSession  string            `no-flag:"true"`
	UncoverCredentials map[string]string `no-flag:"true"`
}

type OutputCalls added in v0.4.0

type OutputCalls string
const (
	OutputCallsHidden  OutputCalls = "hidden"
	OutputCallsCompact OutputCalls = "compact"
)

type OutputDetail added in v0.4.0

type OutputDetail string
const (
	OutputDetailHidden  OutputDetail = "hidden"
	OutputDetailPreview OutputDetail = "preview"
	OutputDetailFull    OutputDetail = "full"
)

type OutputOptions added in v0.4.0

type OutputOptions struct {
	Preset        string `config:"preset" default:"default" description:"Output preset: default, verbose, or full"`
	Reasoning     string `config:"reasoning" default:"hidden" config_optional:"true" description:"Reasoning output: hidden or full"`
	ToolCalls     string `config:"tool_calls" default:"compact" config_optional:"true" description:"Tool call output: hidden or compact"`
	ToolArguments string `config:"tool_arguments" default:"hidden" config_optional:"true" description:"Tool argument output: hidden, preview, or full"`
	ToolResults   string `config:"tool_results" default:"hidden" config_optional:"true" description:"Tool result output: hidden, preview, or full"`
	LiveStatus    *bool  `config:"live_status" default:"true" config_optional:"true" description:"Show the transient thinking/tooling/talking status"`
	Usage         *bool  `config:"usage" default:"true" config_optional:"true" description:"Show token and context usage in the live status"`
}

type OutputPolicy added in v0.4.0

type OutputPolicy struct {
	Preset        OutputPreset
	Reasoning     OutputDetail
	ToolCalls     OutputCalls
	ToolArguments OutputDetail
	ToolResults   OutputDetail
	LiveStatus    bool
	Usage         bool
	Custom        bool
}

func OutputPolicyForLevel added in v0.4.0

func OutputPolicyForLevel(level int) OutputPolicy

func OutputPolicyForPreset added in v0.4.0

func OutputPolicyForPreset(preset OutputPreset) OutputPolicy

func ResolveOutputPolicy added in v0.4.0

func ResolveOutputPolicy(option *Option) (OutputPolicy, error)

func (OutputPolicy) Quiet added in v0.4.0

func (p OutputPolicy) Quiet() bool

func (OutputPolicy) ShowReasoning added in v0.4.0

func (p OutputPolicy) ShowReasoning() bool

type OutputPreset added in v0.4.0

type OutputPreset string
const (
	OutputPresetDefault OutputPreset = "default"
	OutputPresetVerbose OutputPreset = "verbose"
	OutputPresetFull    OutputPreset = "full"
	OutputPresetQuiet   OutputPreset = "quiet"
)

type ReconOptions

type ReconOptions struct {
	FofaKey      string `long:"fofa-key" config:"fofa_key" hidden:"true"`
	HunterAPIKey string `long:"hunter-api-key" config:"hunter_api_key" hidden:"true"`
	TavilyKey    string `long:"tavily-key" config:"tavily_key" hidden:"true"`
	ReconProxy   string `long:"recon-proxy" config:"proxy" hidden:"true"`
	ReconLimit   *int   `long:"recon-limit" config:"limit" hidden:"true"`
}

type RunMode

type RunMode string
const (
	RunModeAgent       RunMode = "agent"
	RunModeIOAServe    RunMode = "ioa serve"
	RunModeIOASpaces   RunMode = "ioa spaces"
	RunModeIOAMessages RunMode = "ioa messages"
	RunModeIOAContext  RunMode = "ioa context"
	RunModeIOANodes    RunMode = "ioa nodes"
	RunModeScanner     RunMode = "scanner"
	RunModeNoCommand   RunMode = ""
)

type ScanConfigOptions

type ScanConfigOptions struct {
	Verify string `config:"verify"`
}

type ScannerCommands

type ScannerCommands struct {
	Scan    struct{} `command:"scan" description:"Run the scan pipeline"`
	Gogo    struct{} `command:"gogo" description:"Run gogo scanner"`
	Spray   struct{} `command:"spray" description:"Run spray scanner"`
	Katana  struct{} `command:"katana" description:"Run katana web crawler"`
	Zombie  struct{} `command:"zombie" description:"Run zombie weakpass scanner"`
	Neutron struct{} `command:"neutron" description:"Run neutron POC scanner"`
	Proton  struct{} `command:"proton" description:"Run proton sensitive info scanner"`
	Passive struct{} `command:"passive" description:"Run passive cyberspace recon"`
}

type ScannerOptions

type ScannerOptions struct {
	CyberhubURL  string `long:"cyberhub-url" config:"url" description:"Cyberhub server URL for loading fingers/templates"`
	CyberhubKey  string `long:"cyberhub-key" config:"key" description:"Cyberhub API key"`
	CyberhubMode string `long:"cyberhub-mode" config:"mode" description:"Cyberhub resource mode: merge or override"`
	Proxy        string `` /* 151-byte string literal not displayed */
}

type SearchConfigOptions added in v0.4.0

type SearchConfigOptions struct {
	TavilyKeys string `config:"tavily_keys" description:"Tavily API keys (comma-separated; empty falls back to DuckDuckGo)"`
}

Jump to

Keyboard shortcuts

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