template

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 17, 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 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

func ListPlaybooks(playbooks map[string]Playbook)

ListPlaybooks prints all available playbooks as a table.

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 LoadRepo added in v0.0.11

func LoadRepo(repoPath string) (map[string]Template, map[string]Playbook, error)

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

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 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

func GetPlaybookByID(playbooks map[string]Playbook, id string) (*Playbook, error)

GetPlaybookByID retrieves a playbook by its ID.

func (Playbook) String added in v0.0.11

func (pb Playbook) String() string

String returns playbook fields as a table.

func (Playbook) Validate added in v0.0.11

func (pb Playbook) Validate() error

Validate checks that the playbook has the required fields.

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.

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 (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