template

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package template provides functionality for loading and managing vulnerable target environment templates.

Index

Constants

View Source
const TemplateRemoteRepository string = "https://github.com/HappyHackingSpace/vt-templates"

TemplateRemoteRepository is a constant for repo url.

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. It searches through all category directories in the templates repository to locate the template. Returns the absolute path to the compose file and the working directory.

func ListTemplates

func ListTemplates(templates map[string]Template)

ListTemplates displays all available templates in a table format.

func ListTemplatesWithFilter

func ListTemplatesWithFilter(templates map[string]Template, filterTag string)

ListTemplatesWithFilter displays templates in a table format, optionally filtered by tag.

func LoadTemplates

func LoadTemplates(repoPath string) (map[string]Template, error)

LoadTemplates loads all templates from the given repository path. If the repository doesn't exist, it clones it first. Returns a map of templates indexed by their ID.

func SyncTemplates

func SyncTemplates(repoPath string) error

SyncTemplates downloads or updates all templates from the remote repository.

Types

type Cvss

type Cvss struct {
	Score   string `yaml:"score"`
	Metrics string `yaml:"metrics"`
}

Cvss represents Common Vulnerability Scoring System information.

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.

func (Info) Validate

func (info Info) Validate(templateID string) error

Validate validates the info structure and content.

type ProviderConfig

type ProviderConfig struct {
	Path string `yaml:"path"`
}

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][]string       `yaml:"poc"`
	Remediation    []string                  `yaml:"remediation"`
	Providers      map[string]ProviderConfig `yaml:"providers"`
	PostInstall    []string                  `yaml:"post-install"`
}

Template represents a vulnerable target environment configuration.

func GetByID

func GetByID(templates map[string]Template, templateID string) (*Template, error)

GetByID retrieves a template by its ID from the given templates map.

func LoadTemplate

func LoadTemplate(filepath string) (Template, error)

LoadTemplate loads a template from the specified filepath by reading the index.yaml file.

func (Template) String

func (t Template) String() string

String returns template fields as a table

func (Template) Validate

func (template Template) Validate() error

Validate validates the template structure and content.

Jump to

Keyboard shortcuts

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