Documentation
¶
Overview ¶
Package template provides functionality for loading and managing vulnerable target environment templates.
Index ¶
- Constants
- func GetDockerComposePath(templateID, repoPath string) (composePath string, workingDir string, err error)
- func ListPlaybooks(playbooks map[string]Playbook)
- func ListTemplates(templates map[string]Template)
- func ListTemplatesWithFilter(templates map[string]Template, filterTag string)
- func LoadRepo(repoPath string) (map[string]Template, map[string]Playbook, error)
- func SyncTemplates(repoPath string) error
- type Cvss
- type Info
- type Playbook
- type PlaybookInfo
- type ProviderConfig
- type Template
Constants ¶
const TemplateRemoteRepository string = "https://github.com/HappyHackingSpace/vt-templates"
TemplateRemoteRepository is the remote URL for the templates repository.
Variables ¶
This section is empty.
Functions ¶
func GetDockerComposePath ¶ added in v0.0.2
func GetDockerComposePath(templateID, repoPath string) (composePath string, workingDir string, err error)
GetDockerComposePath finds and returns the docker-compose file path for a given template ID. Returns the absolute path to the compose file and its working directory.
func ListPlaybooks ¶ added in v0.0.11
ListPlaybooks prints all available playbooks as a table.
func ListTemplates ¶
ListTemplates displays all available templates in a table format.
func ListTemplatesWithFilter ¶
ListTemplatesWithFilter displays templates in a table format, optionally filtered by tag.
func LoadRepo ¶ added in v0.0.11
LoadRepo loads all templates and playbooks from the given repository path in a single directory scan. Clones the repo first if it doesn't exist locally.
func SyncTemplates ¶
SyncTemplates downloads or updates all templates from the remote repository.
Types ¶
type Info ¶
type Info struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Author string `yaml:"author"`
Targets []string `yaml:"targets"`
Type string `yaml:"type"`
AffectedVersions []string `yaml:"affected_versions"`
FixedVersion string `yaml:"fixed_version"`
Cwe string `yaml:"cwe"`
Cvss Cvss `yaml:"cvss"`
Tags []string `yaml:"tags"`
References []string `yaml:"references"`
}
Info contains metadata about a template.
type Playbook ¶ added in v0.0.11
type Playbook struct {
ID string `yaml:"id"`
Info PlaybookInfo `yaml:"info"`
Templates []string `yaml:"templates"`
}
Playbook groups multiple template IDs to run together.
func GetPlaybookByID ¶ added in v0.0.11
GetPlaybookByID retrieves a playbook by its ID.
type PlaybookInfo ¶ added in v0.0.11
type PlaybookInfo struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Author string `yaml:"author"`
}
PlaybookInfo contains metadata about a playbook.
type ProviderConfig ¶
type ProviderConfig struct {
Path string `yaml:"path"`
Image string `yaml:"image,omitempty"`
Ports []int `yaml:"ports,omitempty"`
}
ProviderConfig contains configuration for a specific provider.
func (ProviderConfig) Validate ¶
func (pc ProviderConfig) Validate(templateID, name string) error
Validate validates the provider configuration structure and content.
type Template ¶
type Template struct {
ID string `yaml:"id"`
Info Info `yaml:"info"`
ProofOfConcept map[string]any `yaml:"poc"`
Remediation []string `yaml:"remediation"`
Providers map[string]ProviderConfig `yaml:"providers"`
PostInstall []string `yaml:"post-install"`
}
Template represents a vulnerable target environment configuration.