cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package cmd provides command-line interfaces for the LLMrecon tool

Package cmd provides command-line commands for the LLMrecon tool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheChangelog

func CacheChangelog(changelog *Changelog) error

CacheChangelog saves changelog to local cache

func CheckVersionForCI

func CheckVersionForCI() (string, error)

Extended version check for CI/CD

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetOWASPCategories

func GetOWASPCategories() []string

GetOWASPCategories returns all OWASP LLM Top 10 categories

func ValidateOWASPCategory

func ValidateOWASPCategory(category string) bool

ValidateOWASPCategory validates if a category is valid

Types

type BuildInfo

type BuildInfo struct {
	Date      string `json:"date"`
	Commit    string `json:"commit"`
	Branch    string `json:"branch"`
	Number    string `json:"number"`
	GoVersion string `json:"go_version"`
	Compiler  string `json:"compiler"`
}

BuildInfo contains build-time information

type BundleComplianceStatus

type BundleComplianceStatus struct {
	Present     bool     `json:"present"`
	Version     string   `json:"version"`
	LastUpdated string   `json:"last_updated"`
	Files       []string `json:"files"`
}

BundleComplianceStatus represents compliance standard status

type BundleInfo

type BundleInfo struct {
	Path       string             `json:"path"`
	Size       int64              `json:"size"`
	Checksum   string             `json:"checksum"`
	CreatedAt  time.Time          `json:"created_at"`
	Manifest   BundleManifestInfo `json:"manifest"`
	Components ComponentsInfo     `json:"components"`
	OWASP      OWASPInfo          `json:"owasp"`
	Compliance ComplianceInfo     `json:"compliance"`
	Statistics BundleStatistics   `json:"statistics"`
}

BundleInfo contains comprehensive bundle information

type BundleManifestInfo

type BundleManifestInfo struct {
	Version     string                 `json:"version"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Author      string                 `json:"author"`
	CreatedAt   time.Time              `json:"created_at"`
	Metadata    map[string]interface{} `json:"metadata"`
}

BundleManifestInfo contains manifest information

type BundleMetadata

type BundleMetadata struct {
	Name        string    `json:"name"`
	Version     string    `json:"version"`
	CreatedAt   time.Time `json:"created_at"`
	Description string    `json:"description"`
	Author      string    `json:"author"`
}

type BundleReportData

type BundleReportData struct {
	Metadata        BundleMetadata          `json:"metadata"`
	Summary         ReportSummary           `json:"summary"`
	OWASPAnalysis   *OWASPComplianceReport  `json:"owasp_analysis,omitempty"`
	ISOAnalysis     *ISOComplianceReport    `json:"iso_analysis,omitempty"`
	Statistics      *BundleReportStatistics `json:"statistics,omitempty"`
	Vulnerabilities []VulnerabilityReport   `json:"vulnerabilities,omitempty"`
	Coverage        *CoverageReport         `json:"coverage,omitempty"`
}

type BundleReportStatistics

type BundleReportStatistics struct {
	TemplatesByCategory  map[string]int `json:"templates_by_category"`
	TemplatesBySeverity  map[string]int `json:"templates_by_severity"`
	TemplatesByType      map[string]int `json:"templates_by_type"`
	AverageComplexity    float64        `json:"average_complexity"`
	UniquePatterns       int            `json:"unique_patterns"`
	TotalDetectionRules  int            `json:"total_detection_rules"`
	LanguageDistribution map[string]int `json:"language_distribution"`
	UpdateFrequency      string         `json:"update_frequency"`
}

type BundleStatistics

type BundleStatistics struct {
	TotalFiles      int    `json:"total_files"`
	TotalSize       int64  `json:"total_size"`
	TemplateCount   int    `json:"template_count"`
	ModuleCount     int    `json:"module_count"`
	DocumentCount   int    `json:"document_count"`
	LargestFile     string `json:"largest_file"`
	LargestFileSize int64  `json:"largest_file_size"`
}

BundleStatistics contains bundle statistics

type CategoryCompliance

type CategoryCompliance struct {
	Category        string   `json:"category"`
	Score           float64  `json:"score"`
	TemplateCount   int      `json:"template_count"`
	Coverage        float64  `json:"coverage"`
	MissingPatterns []string `json:"missing_patterns,omitempty"`
}

type CategoryMapping

type CategoryMapping struct {
	Template    string   `json:"template"`
	Path        string   `json:"path"`
	Category    string   `json:"category"`
	Confidence  float64  `json:"confidence"`
	MatchedKeys []string `json:"matched_keywords"`
}

CategoryMapping represents template to category mapping

type CategoryReport

type CategoryReport struct {
	TotalTemplates     int                       `json:"total_templates"`
	CategorizedCount   int                       `json:"categorized_count"`
	UncategorizedCount int                       `json:"uncategorized_count"`
	Categories         map[string]*CategoryStats `json:"categories"`
	Mappings           []CategoryMapping         `json:"mappings"`
	Coverage           map[string]float64        `json:"coverage"`
}

CategoryReport represents categorization results

type CategoryStats

type CategoryStats struct {
	Count      int            `json:"count"`
	Percentage float64        `json:"percentage"`
	Templates  []string       `json:"templates"`
	SubTypes   map[string]int `json:"subtypes,omitempty"`
}

CategoryStats represents statistics for a category

type Changelog

type Changelog struct {
	Component string           `json:"component"`
	Entries   []ChangelogEntry `json:"entries"`
	Generated time.Time        `json:"generated"`
}

Changelog represents the full changelog

type ChangelogEntry

type ChangelogEntry struct {
	Version         string    `json:"version"`
	Date            time.Time `json:"date"`
	Component       string    `json:"component"`
	Summary         string    `json:"summary"`
	BreakingChanges []string  `json:"breaking_changes,omitempty"`
	Features        []string  `json:"features,omitempty"`
	Improvements    []string  `json:"improvements,omitempty"`
	BugFixes        []string  `json:"bug_fixes,omitempty"`
	SecurityFixes   []string  `json:"security_fixes,omitempty"`
	Contributors    []string  `json:"contributors,omitempty"`
	DownloadURL     string    `json:"download_url,omitempty"`
}

ChangelogEntry represents a single changelog entry

type CompatibilityIssue

type CompatibilityIssue struct {
	Component string `json:"component"`
	Issue     string `json:"issue"`
	Severity  string `json:"severity"`
}

CompatibilityIssue represents a compatibility problem

type CompatibilityReport

type CompatibilityReport struct {
	Compatible      bool                 `json:"compatible"`
	Issues          []CompatibilityIssue `json:"issues,omitempty"`
	Recommendations []string             `json:"recommendations,omitempty"`
}

CompatibilityReport contains compatibility check results

type ComplianceDocument

type ComplianceDocument struct {
	Title     string
	Framework string
	Bundle    string
	Version   string
	Date      time.Time
	Sections  []ComplianceSection
}

type ComplianceInfo

type ComplianceInfo struct {
	ISO42001  BundleComplianceStatus `json:"iso42001"`
	OWASP     BundleComplianceStatus `json:"owasp"`
	Documents []string               `json:"documents"`
}

ComplianceInfo contains compliance documentation status

type ComplianceSection

type ComplianceSection struct {
	Title   string
	Content string
}

type ComplianceStatus

type ComplianceStatus struct {
	Framework       string
	Score           float64
	CoveredAreas    int
	TotalAreas      int
	Strengths       []string
	Gaps            []string
	Recommendations []string
}

type ComponentItem

type ComponentItem struct {
	Name     string                 `json:"name"`
	Path     string                 `json:"path"`
	Version  string                 `json:"version"`
	Size     int64                  `json:"size"`
	Checksum string                 `json:"checksum"`
	Category string                 `json:"category,omitempty"`
	Type     string                 `json:"type,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ComponentItem represents a component in the bundle

type ComponentVersion

type ComponentVersion struct {
	Name        string    `json:"name"`
	Version     string    `json:"version"`
	ReleaseDate time.Time `json:"release_date,omitempty"`
	Author      string    `json:"author,omitempty"`
	Description string    `json:"description,omitempty"`
	License     string    `json:"license,omitempty"`
	Homepage    string    `json:"homepage,omitempty"`
}

ComponentVersion represents version info for a component

type ComponentsInfo

type ComponentsInfo struct {
	Templates []ComponentItem `json:"templates"`
	Modules   []ComponentItem `json:"modules"`
	Documents []ComponentItem `json:"documents"`
	Resources []ComponentItem `json:"resources"`
}

ComponentsInfo contains component counts

type CoverageReport

type CoverageReport struct {
	OverallCoverage      float64                    `json:"overall_coverage"`
	CategoryCoverage     map[string]float64         `json:"category_coverage"`
	AttackVectorCoverage map[string]float64         `json:"attack_vector_coverage"`
	UncoveredAreas       []string                   `json:"uncovered_areas"`
	CoverageMatrix       map[string]map[string]bool `json:"coverage_matrix"`
}

type DependencyInfo

type DependencyInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	License string `json:"license,omitempty"`
}

DependencyInfo contains dependency information

type ISOComplianceReport

type ISOComplianceReport struct {
	ComplianceLevel   string                `json:"compliance_level"`
	RequirementsMet   int                   `json:"requirements_met"`
	TotalRequirements int                   `json:"total_requirements"`
	Sections          map[string]ISOSection `json:"sections"`
	Gaps              []ISOGap              `json:"gaps"`
	Recommendations   []string              `json:"recommendations"`
}

type ISOGap

type ISOGap struct {
	Requirement string `json:"requirement"`
	Current     string `json:"current"`
	Expected    string `json:"expected"`
	Priority    string `json:"priority"`
}

type ISOSection

type ISOSection struct {
	Name       string   `json:"name"`
	Compliance float64  `json:"compliance"`
	Status     string   `json:"status"`
	Evidence   []string `json:"evidence,omitempty"`
}

type OWASPCategory

type OWASPCategory struct {
	ID          string   `json:"id"`
	Code        string   `json:"code"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Keywords    []string `json:"keywords"`
	Patterns    []string `json:"patterns"`
	Examples    []string `json:"examples"`
}

OWASPCategory represents a category with full details

type OWASPComplianceCategory

type OWASPComplianceCategory struct {
	ID          string
	Name        string
	Description string
	Mitigation  string
}

type OWASPComplianceReport

type OWASPComplianceReport struct {
	OverallScore     float64                       `json:"overall_score"`
	CategoryScores   map[string]CategoryCompliance `json:"category_scores"`
	CoverageGaps     []string                      `json:"coverage_gaps"`
	Recommendations  []string                      `json:"recommendations"`
	DetailedFindings []OWASPFinding                `json:"detailed_findings,omitempty"`
}

type OWASPFinding

type OWASPFinding struct {
	Category    string `json:"category"`
	Severity    string `json:"severity"`
	Template    string `json:"template"`
	Description string `json:"description"`
	Mitigation  string `json:"mitigation"`
}

type OWASPInfo

type OWASPInfo struct {
	Categorized   bool           `json:"categorized"`
	Categories    map[string]int `json:"categories"`
	Uncategorized int            `json:"uncategorized"`
}

OWASPInfo contains OWASP categorization information

type ReportSummary

type ReportSummary struct {
	TotalTemplates      int      `json:"total_templates"`
	CategoriesCount     int      `json:"categories_count"`
	ComplianceScore     float64  `json:"compliance_score"`
	SecurityLevel       string   `json:"security_level"`
	TopCategories       []string `json:"top_categories"`
	RecommendationCount int      `json:"recommendation_count"`
}

type SystemInfo

type SystemInfo struct {
	OS           string `json:"os"`
	Architecture string `json:"architecture"`
	CPUs         int    `json:"cpus"`
	GoMaxProcs   int    `json:"go_max_procs"`
}

SystemInfo contains system information

type TemplateMetadata

type TemplateMetadata struct {
	Severity string
	Type     string
}

type VersionInfo

type VersionInfo struct {
	Binary        ComponentVersion     `json:"binary"`
	Templates     ComponentVersion     `json:"templates"`
	Modules       []ComponentVersion   `json:"modules"`
	Build         BuildInfo            `json:"build"`
	System        SystemInfo           `json:"system"`
	Dependencies  []DependencyInfo     `json:"dependencies,omitempty"`
	Compatibility *CompatibilityReport `json:"compatibility,omitempty"`
}

VersionInfo contains all version information

type VulnerabilityReport

type VulnerabilityReport struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Category    string   `json:"category"`
	Severity    string   `json:"severity"`
	Description string   `json:"description"`
	Impact      string   `json:"impact"`
	Likelihood  string   `json:"likelihood"`
	Detections  []string `json:"detections"`
	Mitigations []string `json:"mitigations"`
}

Jump to

Keyboard shortcuts

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