plugin

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package plugin provides extension capabilities for Indago

Package plugin provides extension capabilities for Indago

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttackPlugin

type AttackPlugin interface {
	// Name returns the plugin name
	Name() string

	// Description returns a description of what this plugin does
	Description() string

	// AttackTypes returns the attack types this plugin handles
	AttackTypes() []string

	// Generate generates payloads for an endpoint and parameter
	Generate(ctx context.Context, endpoint types.Endpoint, param *types.Parameter) ([]Payload, error)

	// Priority returns the plugin priority (higher = runs first)
	Priority() int
}

AttackPlugin defines the interface for attack payload plugins

type FilePayloadPlugin

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

FilePayloadPlugin is a plugin loaded from a file

func (*FilePayloadPlugin) AttackTypes

func (p *FilePayloadPlugin) AttackTypes() []string

AttackTypes returns the attack types this plugin handles

func (*FilePayloadPlugin) Description

func (p *FilePayloadPlugin) Description() string

Description returns the plugin description

func (*FilePayloadPlugin) Generate

func (p *FilePayloadPlugin) Generate(ctx context.Context, endpoint types.Endpoint, param *types.Parameter) ([]Payload, error)

Generate generates payloads

func (*FilePayloadPlugin) Name

func (p *FilePayloadPlugin) Name() string

Name returns the plugin name

func (*FilePayloadPlugin) Priority

func (p *FilePayloadPlugin) Priority() int

Priority returns the plugin priority

type FileResponseMatcher

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

FileResponseMatcher is a matcher loaded from a file

func (*FileResponseMatcher) Description

func (m *FileResponseMatcher) Description() string

Description returns the matcher description

func (*FileResponseMatcher) Match

func (m *FileResponseMatcher) Match(ctx context.Context, response *types.HTTPResponse, request *types.HTTPRequest) (*MatchResult, error)

Match checks if a response matches

func (*FileResponseMatcher) Name

func (m *FileResponseMatcher) Name() string

Name returns the matcher name

func (*FileResponseMatcher) Priority

func (m *FileResponseMatcher) Priority() int

Priority returns the matcher priority

type Loader

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

Loader loads plugins from external files

func NewLoader

func NewLoader(registry *PluginRegistry) *Loader

NewLoader creates a new plugin loader

func (*Loader) LoadMatcherFile

func (l *Loader) LoadMatcherFile(filePath string) error

LoadMatcherFile loads matchers from a file

func (*Loader) LoadPayloadFile

func (l *Loader) LoadPayloadFile(filePath string) error

LoadPayloadFile loads payloads from a file

type MatchResult

type MatchResult struct {
	Matched     bool              `json:"matched"`
	Severity    string            `json:"severity,omitempty"`
	Confidence  string            `json:"confidence,omitempty"`
	Title       string            `json:"title,omitempty"`
	Description string            `json:"description,omitempty"`
	Evidence    []string          `json:"evidence,omitempty"`
	CWE         string            `json:"cwe,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

MatchResult contains the result of a match operation

type MatcherDef

type MatcherDef struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Patterns    []string `json:"patterns"`
	Severity    string   `json:"severity"`
	Confidence  string   `json:"confidence"`
	CWE         string   `json:"cwe,omitempty"`
}

MatcherDef defines a matcher in a file

type Payload

type Payload struct {
	Value       string            `json:"value"`
	Type        string            `json:"type"`
	Category    string            `json:"category"`
	Description string            `json:"description"`
	Encoding    string            `json:"encoding,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

Payload represents a payload generated by a plugin

type PluginConfig

type PluginConfig struct {
	Enabled      bool     `yaml:"enabled" mapstructure:"enabled"`
	PayloadFiles []string `yaml:"payload_files" mapstructure:"payload_files"`
	MatcherFiles []string `yaml:"matcher_files" mapstructure:"matcher_files"`
}

PluginConfig holds plugin configuration

type PluginRegistry

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

PluginRegistry manages loaded plugins

func LoadPlugins

func LoadPlugins(config PluginConfig) (*PluginRegistry, error)

LoadPlugins loads all plugins from config

func NewRegistry

func NewRegistry() *PluginRegistry

NewRegistry creates a new plugin registry

func (*PluginRegistry) GetAttackPlugins

func (r *PluginRegistry) GetAttackPlugins() []AttackPlugin

GetAttackPlugins returns all registered attack plugins

func (*PluginRegistry) GetPluginsForType

func (r *PluginRegistry) GetPluginsForType(attackType string) []AttackPlugin

GetPluginsForType returns attack plugins that handle a specific type

func (*PluginRegistry) GetResponseMatchers

func (r *PluginRegistry) GetResponseMatchers() []ResponseMatcher

GetResponseMatchers returns all registered response matchers

func (*PluginRegistry) RegisterAttackPlugin

func (r *PluginRegistry) RegisterAttackPlugin(plugin AttackPlugin)

RegisterAttackPlugin registers an attack plugin

func (*PluginRegistry) RegisterResponseMatcher

func (r *PluginRegistry) RegisterResponseMatcher(matcher ResponseMatcher)

RegisterResponseMatcher registers a response matcher

type ResponseMatcher

type ResponseMatcher interface {
	// Name returns the matcher name
	Name() string

	// Description returns a description of what this matcher detects
	Description() string

	// Match checks if a response matches the detection criteria
	Match(ctx context.Context, response *types.HTTPResponse, request *types.HTTPRequest) (*MatchResult, error)

	// Priority returns the matcher priority (higher = runs first)
	Priority() int
}

ResponseMatcher defines the interface for response matching plugins

Jump to

Keyboard shortcuts

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