analyzer

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnrecognizedFormat = errors.New("unrecognized binary format")

ErrUnrecognizedFormat is returned by Dispatcher when no parser recognizes the binary format.

Functions

This section is empty.

Types

type AnalysisResult added in v0.5.0

type AnalysisResult struct {
	Info     binary.Info
	Findings []rule.Finding
}

AnalysisResult contains findings and binary metadata from analysis.

type Dispatcher added in v0.5.0

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

Dispatcher routes binary analysis to format-specific analyzers.

func NewDispatcher added in v0.5.0

func NewDispatcher(opts DispatcherOptions) *Dispatcher

NewDispatcher creates a dispatcher with the given analyzers.

func (*Dispatcher) Analyze added in v0.5.0

func (d *Dispatcher) Analyze(ctx context.Context, r io.ReaderAt) ([]AnalysisResult, error)

Analyze parses the binary and returns analysis results. Returns slice to handle fat/universal binaries (one result per arch slice). Returns ErrUnsupportedFormat if no parser matches, other errors for parse failures.

type DispatcherOptions added in v0.5.0

type DispatcherOptions struct {
	ELF    *ELFAnalyzer
	Logger *slog.Logger
}

DispatcherOptions configures Dispatcher creation.

type ELFAnalyzer added in v0.5.0

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

ELFAnalyzer runs ELF-specific analysis and returns findings.

func NewELFAnalyzer added in v0.5.0

func NewELFAnalyzer(opts ELFAnalyzerOptions) *ELFAnalyzer

NewELFAnalyzer creates an ELF analyzer with the given options.

func (*ELFAnalyzer) Analyze added in v0.5.0

func (a *ELFAnalyzer) Analyze(ctx context.Context, bin *binary.ELFBinary) []rule.Finding

Analyze runs ELF-specific rules against the binary and returns findings.

type ELFAnalyzerOptions added in v0.5.0

type ELFAnalyzerOptions struct {
	Rules            []rule.ELFRule
	DebuginfodClient *debuginfo.Client
	Logger           *slog.Logger
}

ELFAnalyzerOptions configures ELFAnalyzer creation.

type FileResult added in v0.4.0

type FileResult struct {
	Path     string
	Info     binary.Info
	SHA256   string
	Findings []rule.Finding
	Error    error
	Skipped  bool
}

FileResult contains analysis results for a single file (or arch slice for fat binaries).

func (*FileResult) FailedRules added in v0.4.0

func (r *FileResult) FailedRules() int

func (*FileResult) PassedRules added in v0.4.0

func (r *FileResult) PassedRules() int

type Report added in v0.4.0

type Report struct {
	Results []FileResult
}

Jump to

Keyboard shortcuts

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