cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK       = model.ExitOK
	ExitFindings = model.ExitFindings
)

Re-export exit codes for use by main.go.

View Source
const ExitRuntimeError = model.ExitRuntimeError

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

Set via ldflags at build time.

Functions

This section is empty.

Types

type AuditCmd

type AuditCmd struct {
	Linux    LinuxAuditCmd   `cmd:"" help:"Audit Linux packages"`
	Windows  WindowsAuditCmd `cmd:"" help:"Audit Windows KB updates"`
	Host     HostAuditCmd    `cmd:"" help:"Audit host packages (v4 API)"`
	Winaudit WinFullAuditCmd `cmd:"" name:"winaudit" help:"Full Windows audit (KBs + software)"`
}

AuditCmd is the command group for OS package auditing.

type CLI

type CLI struct {
	// Global flags
	Output  string   `help:"Output format (json, table, sarif, html, cyclonedx)" enum:"json,table,sarif,html,cyclonedx" default:"json"`
	Quiet   bool     `help:"Suppress non-error output" short:"q"`
	Verbose bool     `help:"Enable verbose/debug output" short:"v"`
	Offline bool     `help:"Use offline database only"`
	FailOn  string   `help:"Fail with exit code 1 if findings at or above severity (low, medium, high, critical)" default:""`
	Ignore  []string `help:"CVE IDs to ignore"`
	VEX     string   `help:"Path to OpenVEX document for suppression"`

	// Commands
	Version  VersionCmd `cmd:"" help:"Print version information"`
	Search   SearchCmd  `cmd:"" help:"Search Vulners database"`
	CVE      CVECmd     `cmd:"" name:"cve" help:"Look up a CVE by ID"`
	CPE      CPECmd     `cmd:"" name:"cpe" help:"Search by CPE"`
	Audit    AuditCmd   `cmd:"" help:"Audit OS packages"`
	Scan     ScanCmd    `cmd:"" help:"Scan targets for vulnerabilities"`
	Offline_ OfflineCmd `cmd:"" name:"offline" help:"Manage offline database"`
	STIX     StixCmd    `cmd:"" name:"stix" help:"Export STIX bundle for a bulletin or CVE"`
}

CLI is the root Kong command structure.

type CPECmd

type CPECmd struct {
	Product string `arg:"" help:"Product name to search"`
	Vendor  string `help:"Vendor name" default:""`
	Limit   int    `help:"Maximum results to return" default:"10"`
}

CPECmd searches by CPE.

func (*CPECmd) Run

func (c *CPECmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store) error

type CVECmd

type CVECmd struct {
	ID         string `arg:"" help:"CVE identifier (e.g. CVE-2021-44228)"`
	References bool   `help:"Include external references"`
	History    bool   `help:"Include change history"`
}

CVECmd looks up a CVE by ID.

func (*CVECmd) Run

func (c *CVECmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store) error

type CVEOutput

type CVEOutput struct {
	Bulletin   *vulners.Bulletin      `json:"bulletin"`
	References []string               `json:"references,omitempty"`
	History    []vulners.HistoryEntry `json:"history,omitempty"`
}

CVEOutput wraps bulletin data with optional references and history.

type Deps

type Deps struct {
	Intel intel.Client
}

Deps holds shared dependencies injected into commands.

type HostAuditCmd

type HostAuditCmd struct {
	OS       string   `help:"Operating system name (e.g. ubuntu, centos)" required:""`
	Version  string   `help:"OS version (e.g. 22.04, 8)" required:""`
	Packages []string `help:"Packages in 'name version' format" required:""`
}

HostAuditCmd audits host packages using the v4 Host audit API.

func (*HostAuditCmd) Run

func (c *HostAuditCmd) Run(ctx context.Context, globals *CLI, deps *Deps) error

type LinuxAuditCmd

type LinuxAuditCmd struct {
	Distro  string   `help:"Linux distribution name (e.g. ubuntu, debian, centos)" required:""`
	Version string   `help:"Distribution version (e.g. 22.04)" required:""`
	Pkg     []string `help:"Package names with versions (e.g. openssl=3.0.2)" required:""`
}

LinuxAuditCmd audits Linux distribution packages.

func (*LinuxAuditCmd) Run

func (c *LinuxAuditCmd) Run(ctx context.Context, globals *CLI, deps *Deps) error

type OfflineCmd

type OfflineCmd struct {
	Sync   OfflineSyncCmd   `cmd:"" help:"Sync vulnerability data for offline use"`
	Status OfflineStatusCmd `cmd:"" help:"Show offline database status"`
	Purge  OfflinePurgeCmd  `cmd:"" help:"Purge offline database"`
}

OfflineCmd is the command group for offline mode management.

type OfflinePurgeCmd

type OfflinePurgeCmd struct{}

OfflinePurgeCmd clears the offline database.

func (*OfflinePurgeCmd) Run

func (c *OfflinePurgeCmd) Run(ctx context.Context, store cache.Store, logger *slog.Logger) error

type OfflineStatusCmd

type OfflineStatusCmd struct{}

OfflineStatusCmd shows offline database status.

func (*OfflineStatusCmd) Run

func (c *OfflineStatusCmd) Run(ctx context.Context, globals *CLI, store cache.Store) error

type OfflineSyncCmd

type OfflineSyncCmd struct {
	Collections []string `help:"Collections to sync (e.g. cve,exploit,debian)" default:"cve"`
	Full        bool     `help:"Force full sync even if recent data exists"`
}

OfflineSyncCmd syncs vulnerability data for offline use.

func (*OfflineSyncCmd) Run

func (c *OfflineSyncCmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store, logger *slog.Logger) error

type ScanCmd

type ScanCmd struct {
	Repo  ScanRepoCmd  `cmd:"" help:"Scan a repository for vulnerabilities"`
	SBOM  ScanSBOMCmd  `cmd:"" name:"sbom" help:"Scan an SBOM file"`
	Image ScanImageCmd `cmd:"" help:"Scan a container image (requires syft)"`
	Dir   ScanDirCmd   `cmd:"" help:"Scan a directory for package manifests"`
}

ScanCmd is the command group for scanning targets.

type ScanDirCmd

type ScanDirCmd struct {
	Path string `arg:"" help:"Directory path to scan" default:"."`
}

ScanDirCmd scans a directory for package manifests and finds vulnerabilities.

func (*ScanDirCmd) Run

func (c *ScanDirCmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store, logger *slog.Logger) error

type ScanImageCmd

type ScanImageCmd struct {
	Image string `arg:"" help:"Image reference (e.g. alpine:3.18, ./image.tar)"`
}

ScanImageCmd scans a container image (requires syft for SBOM generation).

func (*ScanImageCmd) Run

func (c *ScanImageCmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store, logger *slog.Logger) error

type ScanOutput

type ScanOutput struct {
	SchemaVersion string            `json:"schemaVersion"`
	Target        string            `json:"target"`
	Components    []model.Component `json:"components"`
	Findings      []model.Finding   `json:"findings"`
	Summary       ScanSummary       `json:"summary"`
}

ScanOutput is the structured output for scan commands.

type ScanRepoCmd

type ScanRepoCmd struct {
	Path string `arg:"" help:"Path to repository" default:"."`
}

ScanRepoCmd scans a repository for vulnerabilities.

func (*ScanRepoCmd) Run

func (c *ScanRepoCmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store, logger *slog.Logger) error

type ScanSBOMCmd

type ScanSBOMCmd struct {
	File   string `arg:"" help:"Path to SBOM file"`
	Format string `help:"SBOM format (cyclonedx, spdx)" enum:"cyclonedx,spdx" default:"cyclonedx"`
}

ScanSBOMCmd scans an SBOM file for vulnerabilities.

func (*ScanSBOMCmd) Run

func (c *ScanSBOMCmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store, logger *slog.Logger) error

type ScanSummary

type ScanSummary struct {
	ComponentCount int `json:"componentCount"`
	FindingCount   int `json:"findingCount"`
	Critical       int `json:"critical"`
	High           int `json:"high"`
	Medium         int `json:"medium"`
	Low            int `json:"low"`
	ExploitedCount int `json:"exploitedCount,omitempty"`
	HighEPSSCount  int `json:"highEpssCount,omitempty"`
}

ScanSummary summarizes scan results.

type SearchCmd

type SearchCmd struct {
	Query    string `arg:"" help:"Lucene search query"`
	Limit    int    `help:"Maximum results to return" default:"10"`
	Offset   int    `help:"Result offset for pagination" default:"0"`
	Exploits bool   `help:"Search exploits only"`
}

SearchCmd searches the Vulners database.

func (*SearchCmd) Run

func (c *SearchCmd) Run(ctx context.Context, globals *CLI, deps *Deps, store cache.Store) error

type StixCmd

type StixCmd struct {
	ID    string `arg:"" help:"Bulletin or CVE identifier"`
	ByCVE bool   `help:"Look up by CVE ID instead of bulletin ID"`
}

StixCmd exports STIX bundles from Vulners.

func (*StixCmd) Run

func (c *StixCmd) Run(ctx context.Context, globals *CLI, deps *Deps) error

type VersionCmd

type VersionCmd struct{}

VersionCmd prints version information.

func (*VersionCmd) Run

func (c *VersionCmd) Run(globals *CLI) error

Run executes the version command.

type VersionInfo

type VersionInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	Date      string `json:"date"`
	GoVersion string `json:"goVersion"`
}

VersionInfo holds version metadata.

type WinFullAuditCmd

type WinFullAuditCmd struct {
	OS       string   `help:"Windows version (e.g. 'Windows 10')" required:""`
	Version  string   `help:"OS build version" required:""`
	KB       []string `help:"Installed KB numbers"`
	Software []string `help:"Installed software in 'name version' format"`
}

WinFullAuditCmd audits Windows using the WinAudit API (KBs + software).

func (*WinFullAuditCmd) Run

func (c *WinFullAuditCmd) Run(ctx context.Context, globals *CLI, deps *Deps) error

type WindowsAuditCmd

type WindowsAuditCmd struct {
	OS string   `help:"Windows OS version (e.g. 'Windows 10')" default:"Windows 10"`
	KB []string `help:"Installed KB identifiers" required:""`
}

WindowsAuditCmd audits Windows KB updates.

func (*WindowsAuditCmd) Run

func (c *WindowsAuditCmd) Run(ctx context.Context, globals *CLI, deps *Deps) error

Jump to

Keyboard shortcuts

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