Documentation
¶
Overview ¶
Package plugin provides the core plugin architecture for Aurelian modules. This replaces the dependency on the Janus framework with a simple, standalone plugin system inspired by Nerva's architecture.
Package plugin provides the core plugin architecture for Aurelian modules.
Index ¶
- Constants
- Variables
- func Bind(cfg Config, dst any) error
- func Count() int
- func GetHierarchy() map[Platform]map[Category][]string
- func IsSystemProject(projectID string) bool
- func Register(m Module)
- func RegisterAzureEnricher(resourceType string, fn AzureEnricherFunc)
- func RegisterAzureEvaluator(templateID string, fn AzureEvaluatorFunc)
- func RegisterEnricher(resourceType string, fn EnricherFunc)
- func RegisterGCPEnricher(resourceType string, fn GCPEnricherFunc)
- func ResetAzureEnricherRegistry()
- func ResetAzureEvaluatorRegistry()
- func ResetEnricherRegistry()
- func ResetGCPEnricherRegistry()
- func ResetRegistry()
- type AWSCommonRecon
- type AWSReconBase
- type AzureCommonRecon
- type AzureEnricherConfig
- type AzureEnricherFunc
- type AzureEntraRecon
- type AzureEvaluatorFunc
- type AzureReconBase
- type Category
- type Config
- type ConsoleFormatter
- type EnricherConfig
- type EnricherFunc
- type Finding
- type Formatter
- type GCPCommonRecon
- type GCPEnricherConfig
- type GCPEnricherFunc
- type GraphFormatter
- type GraphOutputBase
- type JSONFormatter
- type Logger
- func (l *Logger) Banner(text string)
- func (l *Logger) Fail(format string, args ...any)
- func (l *Logger) Info(format string, args ...any)
- func (l *Logger) ProgressFunc(label string) func(completed, total int64)
- func (l *Logger) RenderProgress(label string, completed, total int64)
- func (l *Logger) Status(format string, args ...any)
- func (l *Logger) Success(format string, args ...any)
- func (l *Logger) Warn(format string, args ...any)
- type Module
- type ModuleWrapper
- type OrgPoliciesParam
- type Parameter
- type Parameters
- func (ps *Parameters) Bool(name string) bool
- func (ps *Parameters) Int(name string) int
- func (ps *Parameters) IsSet(name string) bool
- func (ps *Parameters) Set(name string, value any)
- func (ps *Parameters) String(name string) string
- func (ps *Parameters) StringSlice(name string) []string
- func (ps *Parameters) Validate() error
- type Platform
- type PostBinder
- type RegistryEntry
- type SlogHandler
Constants ¶
const (
AnyResourceType = "any"
)
Variables ¶
var Registry = ®istry{ modules: make(map[string]RegistryEntry), hierarchy: make(map[Platform]map[Category][]string), }
Registry is the global module registry
Functions ¶
func GetHierarchy ¶
GetHierarchy returns the complete module hierarchy for CLI generation The returned map is a copy, safe for concurrent use
func IsSystemProject ¶
func Register ¶
func Register(m Module)
Register adds a module to the registry This function is thread-safe and can be called from init() functions
func RegisterAzureEnricher ¶
func RegisterAzureEnricher(resourceType string, fn AzureEnricherFunc)
RegisterAzureEnricher registers an enricher function for a resource type. The resourceType should be lowercase (e.g., "microsoft.web/sites"). Called from init() in individual enricher files.
func RegisterAzureEvaluator ¶
func RegisterAzureEvaluator(templateID string, fn AzureEvaluatorFunc)
RegisterAzureEvaluator registers an evaluator function for a template ID.
func RegisterEnricher ¶
func RegisterEnricher(resourceType string, fn EnricherFunc)
func RegisterGCPEnricher ¶
func RegisterGCPEnricher(resourceType string, fn GCPEnricherFunc)
func ResetAzureEnricherRegistry ¶
func ResetAzureEnricherRegistry()
ResetAzureEnricherRegistry clears all registered Azure enrichers. Test utility only.
func ResetAzureEvaluatorRegistry ¶
func ResetAzureEvaluatorRegistry()
ResetAzureEvaluatorRegistry clears all registered evaluators. Test utility only.
func ResetEnricherRegistry ¶
func ResetEnricherRegistry()
func ResetGCPEnricherRegistry ¶
func ResetGCPEnricherRegistry()
func ResetRegistry ¶
func ResetRegistry()
ResetRegistry clears the global registry. Intended for tests.
Types ¶
type AWSCommonRecon ¶
type AWSCommonRecon struct {
AWSReconBase
Concurrency int `param:"concurrency" desc:"Maximum concurrent API requests" default:"5"`
Regions []string `param:"regions" desc:"AWS regions to scan" default:"all" shortcode:"r"`
ResourceType []string `param:"resource-type" desc:"AWS Cloud Control resource type" default:"all" shortcode:"t"`
ResourceARN []string `param:"resource-arn" desc:"AWS target resource ARN" shortcode:"a"`
}
type AWSReconBase ¶
type AWSReconBase struct {
OutputDir string `param:"output-dir" desc:"Base output directory" default:"aurelian-output"`
Profile string `param:"profile" desc:"AWS profile to use" shortcode:"p"`
ProfileDir string `param:"profile-dir" desc:"Set to override the default AWS profile directory"`
OpsecLevel string `param:"opsec_level" desc:"Operational security level for AWS operations" default:"none"`
}
type AzureCommonRecon ¶
type AzureCommonRecon struct {
AzureReconBase
Concurrency int `param:"concurrency" desc:"Maximum concurrent API requests" default:"5"`
SubscriptionIDs []string `` /* 135-byte string literal not displayed */
AzureCredential azcore.TokenCredential `param:"-"`
}
AzureCommonRecon contains common parameters for Azure reconnaissance modules.
type AzureEnricherConfig ¶
type AzureEnricherConfig struct {
Context context.Context
Credential azcore.TokenCredential
}
AzureEnricherConfig provides context and credentials to Azure enricher functions.
type AzureEnricherFunc ¶
type AzureEnricherFunc func(cfg AzureEnricherConfig, result *templates.ARGQueryResult) error
AzureEnricherFunc adds properties to an ARG query result via Azure SDK API calls. Enrichers mutate result.Properties and always return nil on success. Errors are logged by the pipeline wrapper; the result is still forwarded.
func GetAzureEnrichers ¶
func GetAzureEnrichers(resourceType string) []AzureEnricherFunc
GetAzureEnrichers returns all enrichers registered for a resource type.
type AzureEntraRecon ¶
type AzureEntraRecon struct {
AzureReconBase
AzureCredential azcore.TokenCredential `param:"-"`
}
AzureEntraRecon contains parameters for Entra ID (Azure AD) modules that operate at the tenant level and do not require subscription IDs.
type AzureEvaluatorFunc ¶
type AzureEvaluatorFunc func(result templates.ARGQueryResult) bool
AzureEvaluatorFunc checks enriched properties on an ARG query result. Returns true to confirm the finding, false to drop it.
func GetAzureEvaluator ¶
func GetAzureEvaluator(templateID string) (AzureEvaluatorFunc, bool)
GetAzureEvaluator returns the evaluator for a template ID, if any.
type AzureReconBase ¶
type AzureReconBase struct {
OutputDir string `param:"output-dir" desc:"Base output directory" default:"aurelian-output"`
}
AzureReconBase contains base parameters shared by all Azure recon modules.
type Config ¶
type Config struct {
Args map[string]any // Runtime arguments (backward compat)
Params Parameters // Typed parameter set
Context context.Context // Execution context
Output io.Writer // Output destination
Verbose bool // Verbose logging
Log *Logger // User-facing terminal logger
}
Config holds runtime configuration for a module
type ConsoleFormatter ¶
ConsoleFormatter outputs results to console in a human-readable format
func (*ConsoleFormatter) Format ¶
func (f *ConsoleFormatter) Format(results []model.AurelianModel) error
Format implements the Formatter interface for console output
type EnricherFunc ¶
type EnricherFunc func(cfg EnricherConfig, r *output.AWSResource) error
func GetEnrichers ¶
func GetEnrichers(resourceType string) []EnricherFunc
type Finding ¶
type Finding struct {
model.BaseAurelianModel
// RuleID is the machine-readable identifier for the detection rule
// Examples: "lambda-no-auth-function-url", "s3-public-bucket"
RuleID string
// Severity indicates impact level
// Valid values: "low", "medium", "high", "critical"
Severity string
// Name is the human-readable name of the finding
// Example: "Lambda Function URL Without Authentication"
Name string
// Description provides detailed explanation of the vulnerability
Description string
// Resource is the cloud resource with the vulnerability
Resource output.AWSResource
// References contains external documentation links (optional)
References []string
// Recommendation provides remediation guidance (optional)
Recommendation string
}
Finding represents a security vulnerability or misconfiguration discovered by an analyzer. Analyzers (both YAML rules and Go modules) return []Finding from their Run() method.
type Formatter ¶
type Formatter interface {
Format(results []model.AurelianModel) error
}
Formatter handles output formatting for module results
type GCPCommonRecon ¶
type GCPCommonRecon struct {
ProjectID []string `param:"project-id" desc:"GCP project IDs" shortcode:"p"`
OrgID []string `param:"org-id" desc:"GCP organization IDs" shortcode:"o"`
FolderID []string `param:"folder-id" desc:"GCP folder IDs"`
ResourceType []string `param:"resource-type" desc:"Resource types to enumerate" default:"all" shortcode:"t"`
Concurrency int `param:"concurrency" desc:"Max concurrent API requests" default:"5"`
CredentialsFile string `param:"creds-file" desc:"Path to GCP credentials JSON" shortcode:"c"`
IncludeSysProjects bool `param:"include-sys-projects" desc:"Include system projects" default:"false"`
ClientOptions []option.ClientOption `param:"-"`
ResolvedProjects []string `param:"-"`
}
type GCPEnricherConfig ¶
type GCPEnricherConfig struct {
Context context.Context
ClientOptions []option.ClientOption
}
type GCPEnricherFunc ¶
type GCPEnricherFunc func(cfg GCPEnricherConfig, r *output.GCPResource) error
func GetGCPEnrichers ¶
func GetGCPEnrichers(resourceType string) []GCPEnricherFunc
type GraphFormatter ¶
type GraphFormatter struct {
// contains filtered or unexported fields
}
GraphFormatter formats module results as Neo4j graph
func NewGraphFormatter ¶
func NewGraphFormatter(uri, username, password string) (*GraphFormatter, error)
NewGraphFormatter creates a new graph formatter with Neo4j connection
func (*GraphFormatter) Close ¶
func (f *GraphFormatter) Close() error
Close releases database resources
func (*GraphFormatter) Format ¶
func (f *GraphFormatter) Format(results []model.AurelianModel) error
Format processes module results and writes to Neo4j
type GraphOutputBase ¶
type GraphOutputBase struct {
Neo4jURI string `param:"neo4j-uri" desc:"Neo4j connection URI (e.g., bolt://localhost:7687)" default:""`
Neo4jUsername string `param:"neo4j-username" desc:"Neo4j username" default:"neo4j"`
Neo4jPassword string `param:"neo4j-password" desc:"Neo4j password" default:"neo4j" sensitive:"true"`
}
GraphOutputBase provides reusable Neo4j connection parameters. Embed in any module config that needs graph output. Usage: type MyConfig struct { plugin.GraphOutputBase }
type JSONFormatter ¶
JSONFormatter outputs results as JSON
func (*JSONFormatter) Format ¶
func (f *JSONFormatter) Format(results []model.AurelianModel) error
Format implements the Formatter interface for JSON output
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides pwnlib-style terminal output for modules. User-facing messages (Success, Fail, Info, Warn) always print unless quiet. Status provides transient in-place updates for phase messages. RenderProgress manages a multi-line progress area at the bottom of output. Framework/debug messages should use slog directly.
func DiscardLogger ¶
func DiscardLogger() *Logger
DiscardLogger returns a Logger that silently discards all output. Used as a default when no Logger is configured (e.g., library usage, tests).
func NewLogger ¶
NewLogger creates a Logger writing to w. If noColor is true, ANSI colors are disabled. If quiet is true, all user messages are suppressed.
func (*Logger) ProgressFunc ¶
ProgressFunc returns a callback bound to the given label, suitable for passing directly to pipeline.PipeOpts.Progress.
func (*Logger) RenderProgress ¶
RenderProgress renders a progress bar for the given label. Each unique label gets its own dedicated line in a multi-line progress area.
When completed and total are both negative, the bar for that label is removed (used as a completion signal by the pipeline).
When total is negative (but not -1,-1 sentinel), it signals that the upstream input is still flowing — the absolute value is the current item count and the bar is capped at 99% to prevent false 100% readings. Once total becomes positive, the denominator is final and real progress is shown.
On non-TTY or quiet mode, progress updates are suppressed.
func (*Logger) Status ¶
Status displays a transient in-place message (cyan [~]). On non-TTY or quiet mode, status messages are suppressed. When progress bars are active, Status is a no-op (progress bars provide the visual feedback).
type Module ¶
type Module interface {
// Metadata
ID() string
Name() string
Description() string
Platform() Platform
Category() Category
OpsecLevel() string
Authors() []string
References() []string
SupportedResourceTypes() []string
// Parameters returns a pointer to the module's config struct for parameter
// binding, or nil if the module has no parameters. The returned value is
// used both for deriving CLI flags (via ParametersFrom) and as the bind
// target for Bind before Run is called.
Parameters() any
// Execution — send results into the pipeline via out.Send().
// The caller owns the pipeline lifecycle (including Close).
Run(cfg Config, out *pipeline.P[model.AurelianModel]) error
}
Module is the core interface that all Aurelian modules implement
func ByPlatform ¶ added in v1.0.3
ByPlatform returns a snapshot of all registered modules for a given platform. Safe for concurrent use; returns a freshly-allocated slice on each call so callers cannot mutate registry state.
type ModuleWrapper ¶
type ModuleWrapper struct {
Module
}
func (*ModuleWrapper) Run ¶
func (m *ModuleWrapper) Run(cfg Config, out *pipeline.P[model.AurelianModel]) error
type OrgPoliciesParam ¶
type OrgPoliciesParam struct {
OrgPoliciesFile string `param:"org-policies-file" desc:"Path to Org Policies JSON file"`
OrgPolicies *orgpolicies.OrgPolicies `param:"-"`
}
type Parameter ¶
type Parameter struct {
Name string
Description string
Type string // "string", "int", "bool", "[]string"
Required bool
Default any
Shortcode string
Hidden bool // Hide from help output
Pattern *regexp.Regexp // Regex validation for string values
Enum []string // Allowed values (case-insensitive)
Sensitive bool // Mask in logs and help text
Value any // Runtime value
IsSet bool // Whether explicitly provided
}
Parameter describes a module parameter
func ParametersFrom ¶
ParametersFrom derives []Parameter from a struct's field tags. Supported tags: param, desc, default, enum, shortcode, required, hidden, sensitive.
Every exported, non-embedded field in the struct must have a `param` tag (use `param:"-"` to explicitly skip a field). This prevents silent misconfiguration where a module author adds a field but forgets to tag it.
func (*Parameter) EffectiveValue ¶
EffectiveValue returns the explicitly set value, or the default, or nil.
type Parameters ¶
type Parameters struct {
// contains filtered or unexported fields
}
Parameters is a typed, validated parameter collection.
func NewParameters ¶
func NewParameters(params ...Parameter) Parameters
NewParameters creates a Parameters set from the given parameters.
func (*Parameters) Bool ¶
func (ps *Parameters) Bool(name string) bool
Bool returns the effective bool value for the named parameter.
func (*Parameters) Int ¶
func (ps *Parameters) Int(name string) int
Int returns the effective int value for the named parameter.
func (*Parameters) IsSet ¶
func (ps *Parameters) IsSet(name string) bool
IsSet reports whether the named parameter was explicitly provided.
func (*Parameters) Set ¶
func (ps *Parameters) Set(name string, value any)
Set assigns a value to the named parameter and marks it as explicitly set.
func (*Parameters) String ¶
func (ps *Parameters) String(name string) string
String returns the effective string value for the named parameter.
func (*Parameters) StringSlice ¶
func (ps *Parameters) StringSlice(name string) []string
StringSlice returns the effective []string value for the named parameter.
func (*Parameters) Validate ¶
func (ps *Parameters) Validate() error
Validate checks all constraints: required fields, patterns, enums, and group rules.
type PostBinder ¶
ModuleWrapper wraps a Module so that Run automatically binds cfg.Args into the module's Parameters struct before delegating to the inner Run method. All modules retrieved from the registry are wrapped, ensuring callers never need to call Bind manually.
type RegistryEntry ¶
RegistryEntry holds a module and its platform/category metadata
type SlogHandler ¶
type SlogHandler struct {
// contains filtered or unexported fields
}
SlogHandler routes slog messages through the Logger for clean terminal output. Warn messages render as [!], Error messages render as [-]. Info and Debug are controlled by the minimum level.
func NewSlogHandler ¶
func NewSlogHandler(logger *Logger, minLevel slog.Level) *SlogHandler
NewSlogHandler creates a slog.Handler that routes through the Logger. Messages below minLevel are suppressed. Warn/Error always route through the Logger regardless of level (they use [!] and [-] prefixes).