detonators

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package detonators executes attack simulations, via simulation packs or the AWS CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupLogging

func SetupLogging(fields logrus.Fields)

SetupLogging redirects the standard library's log package to logrus (decorated with the supplied fields). Log level, format, and silencing are controlled at process startup — the CLI sets them via flags, the server via Bootstrap.Debug — so this function no longer touches them.

Types

type AWSCLIDetonator

type AWSCLIDetonator struct {
	Script string
	// contains filtered or unexported fields
}

AWSCLIDetonator allows to execute arbitrary AWS CLI commands, pre-configured to inject the detonation UUID in the user-agent.

func NewAWSCLIDetonator

func NewAWSCLIDetonator(script string) *AWSCLIDetonator

func (*AWSCLIDetonator) CloudProvider

func (m *AWSCLIDetonator) CloudProvider() string

func (*AWSCLIDetonator) Detonate

func (m *AWSCLIDetonator) Detonate() (map[string]string, error)

func (*AWSCLIDetonator) PackName

func (m *AWSCLIDetonator) PackName() string

func (*AWSCLIDetonator) SetEnvVars

func (m *AWSCLIDetonator) SetEnvVars(envVars map[string]string)

func (*AWSCLIDetonator) SetRunID

func (m *AWSCLIDetonator) SetRunID(runID string)

func (*AWSCLIDetonator) SetStatusCallback

func (m *AWSCLIDetonator) SetStatusCallback(callback func(phase string))

func (*AWSCLIDetonator) SimulationId

func (m *AWSCLIDetonator) SimulationId() string

func (*AWSCLIDetonator) String

func (m *AWSCLIDetonator) String() string

type Detonator

type Detonator interface {
	Detonate() (map[string]string, error)

	String() string

	// SimulationId returns the ID of the attack simulation being detonated
	SimulationId() string

	// CloudProvider returns the cloud provider targeted by this detonator.
	// Returns "aws", "gcp", "azure", or "" if unknown.
	CloudProvider() string

	// PackName returns the name of the pack for simrun detonators.
	// Returns empty string for non-simrun detonators.
	PackName() string

	// SetRunID sets the run ID for structured log routing.
	SetRunID(runID string)

	// SetStatusCallback sets a callback for reporting phase transitions during detonation.
	// Detonators should call this with phase names like "warmup" or "detonating".
	SetStatusCallback(callback func(phase string))

	// SetEnvVars sets run-specific environment variables for credential isolation.
	// These are used instead of the global process env when spawning child
	// processes or configuring SDK clients.
	SetEnvVars(envVars map[string]string)
}

type DetonatorOptions

type DetonatorOptions struct {
	DataDir          string
	TerraformVersion string
	PackLogsEnabled  bool
}

DetonatorOptions carries the configuration NewSimrunDetonator needs from its caller. Populated by the web layer from Bootstrap+AppConfig.

type LogrusWriter

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

LogrusWriter redirects standard log output to logrus with global fields

func NewLogrusWriter

func NewLogrusWriter(fields logrus.Fields) *LogrusWriter

NewLogrusWriter creates a new LogrusWriter with the given fields

func (*LogrusWriter) Write

func (w *LogrusWriter) Write(p []byte) (n int, err error)

type SimrunDetonator

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

SimrunDetonator detonates attack simulations using simulation packs.

func NewSimrunDetonator

func NewSimrunDetonator(simulationID string, packConfig config.PackConfig, params map[string]any, opts DetonatorOptions) (*SimrunDetonator, error)

NewSimrunDetonator creates a new SimrunDetonator for the given simulation.

func (*SimrunDetonator) CloudProvider

func (d *SimrunDetonator) CloudProvider() string

CloudProvider returns the cloud provider inferred from the simulation ID.

func (*SimrunDetonator) Detonate

func (d *SimrunDetonator) Detonate() (map[string]string, error)

Detonate executes the attack simulation via the pack.

func (*SimrunDetonator) PackName

func (d *SimrunDetonator) PackName() string

PackName returns the name of the pack being used.

func (*SimrunDetonator) SetEnvVars

func (d *SimrunDetonator) SetEnvVars(envVars map[string]string)

SetEnvVars sets run-specific environment variables for credential isolation.

func (*SimrunDetonator) SetRunID

func (d *SimrunDetonator) SetRunID(runID string)

SetRunID sets the run ID for structured log routing.

func (*SimrunDetonator) SetStatusCallback

func (d *SimrunDetonator) SetStatusCallback(callback func(phase string))

SetStatusCallback sets a callback for reporting phase transitions during detonation.

func (*SimrunDetonator) SimulationId

func (d *SimrunDetonator) SimulationId() string

SimulationId returns the simulation ID being detonated.

func (*SimrunDetonator) String

func (d *SimrunDetonator) String() string

String returns a string representation of the detonator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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