report

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package report handles all output formatting for Batesian findings.

Index

Constants

This section is empty.

Variables

View Source
var (
	Bold    = color.New(color.Bold).SprintFunc()
	Green   = color.New(color.FgGreen, color.Bold).SprintFunc()
	Yellow  = color.New(color.FgYellow, color.Bold).SprintFunc()
	Red     = color.New(color.FgRed, color.Bold).SprintFunc()
	Cyan    = color.New(color.FgCyan).SprintFunc()
	Dim     = color.New(color.Faint).SprintFunc()
	BoldRed = color.New(color.FgRed, color.Bold).SprintFunc()
)

Color helpers - centralized so they can be disabled (e.g. no-color, CI).

Functions

func WriteSARIF

func WriteSARIF(w io.Writer, target string, results []engine.RunResult, toolVersion string) error

WriteSARIF encodes the scan results as SARIF v2.1.0 JSON to w.

Types

type AttackFlag

type AttackFlag struct {
	Severity string // "critical", "high", "medium", "low", "info"
	RuleID   string
	Message  string
}

AttackFlag represents a notable finding from the probe phase.

type Format

type Format string

Format represents the output format for a report.

const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
	FormatSARIF Format = "sarif"
)

func ParseFormat

func ParseFormat(s string) (Format, error)

ParseFormat parses a format string into a Format. Returns an error for unknown format strings rather than silently defaulting to table, so typos like --output=jsno are caught immediately.

type MCPProbeResult

type MCPProbeResult struct {
	ServerName      string
	ServerVersion   string
	ServerTitle     string
	URL             string
	ProtocolVersion string
	Elapsed         time.Duration

	// Capabilities
	HasTools     bool
	HasResources bool
	HasPrompts   bool
	HasSampling  bool
	HasLogging   bool

	// Enumerated surface
	Tools     []MCPToolSummary
	Resources []MCPResourceSummary
	Prompts   []MCPPromptSummary

	// Attack surface flags
	Flags []AttackFlag
}

MCPProbeResult holds the structured data from an MCP probe.

type MCPPromptSummary

type MCPPromptSummary struct {
	Name        string
	ArgCount    int
	HasRequired bool
}

MCPPromptSummary is a condensed view of an MCP prompt template.

type MCPResourceSummary

type MCPResourceSummary struct {
	URI      string
	MimeType string
}

MCPResourceSummary is a condensed view of an MCP resource.

type MCPToolSummary

type MCPToolSummary struct {
	Name        string
	Description string
}

MCPToolSummary is a condensed view of an MCP tool.

type Printer

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

Printer writes formatted output to a writer.

func New

func New(w io.Writer, verbose bool) *Printer

New creates a Printer writing to w.

func (*Printer) Banner

func (p *Printer) Banner()

Banner prints the Batesian tool banner.

func (*Printer) Error

func (p *Printer) Error(msg string)

Error prints an error message.

func (*Printer) Info

func (p *Printer) Info(msg string)

Info prints an informational message.

func (*Printer) PrintJSON

func (p *Printer) PrintJSON(v any) error

PrintJSON marshals v to indented JSON and writes it to the printer's writer.

func (*Printer) PrintMCPProbeTable

func (p *Printer) PrintMCPProbeTable(r *MCPProbeResult)

PrintMCPProbeTable renders an MCP probe result to the terminal.

func (*Printer) PrintProbeTable

func (p *Printer) PrintProbeTable(r *ProbeResult)

PrintProbeTable renders the probe result as a formatted table to the terminal.

func (*Printer) PrintScanSummary

func (p *Printer) PrintScanSummary(results []engine.RunResult)

PrintScanSummary renders the scan results as a terminal table.

func (*Printer) ProbeHeader

func (p *Printer) ProbeHeader(target, protocol string)

ProbeHeader prints the probe target header.

func (*Printer) Success

func (p *Printer) Success(msg string)

Success prints a success message.

func (*Printer) Verbose

func (p *Printer) Verbose(msg string)

Verbose prints msg only when verbose mode is enabled.

func (*Printer) Warn

func (p *Printer) Warn(msg string)

Warn prints a warning message.

type ProbeResult

type ProbeResult struct {
	// Basic info
	Name        string
	Description string
	URL         string
	Version     string
	Provider    string

	// Capabilities
	Streaming             bool
	PushNotifications     bool
	ExtendedCardAvailable bool

	// Security
	AuthRequired    bool
	SecuritySchemes []string

	// Skills
	Skills []SkillSummary

	// Attack surface flags
	Flags []AttackFlag

	// Timing
	Elapsed time.Duration
}

ProbeResult holds the structured data for a probe result display.

type SkillSummary

type SkillSummary struct {
	ID          string
	Name        string
	Description string
	Tags        []string
}

SkillSummary is a condensed view of a skill.

Jump to

Keyboard shortcuts

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