Documentation
¶
Index ¶
- func Manifest() capkit.Manifest
- func NewCapability(deps capkit.Deps) (capkit.Capability, error)
- func ValidatePack(p *Pack) error
- func ValidateTemplate(t Template) error
- type Capability
- type Catalog
- func (c *Catalog) AddPack(p *Pack) error
- func (c *Catalog) Count() int
- func (c *Catalog) Get(_ context.Context, id string) (capkit.TemplateRef, bool, error)
- func (c *Catalog) PackNames() []string
- func (c *Catalog) Reload(ctx context.Context, sources ...PackSource) error
- func (c *Catalog) Search(_ context.Context, q capkit.TemplateQuery) ([]capkit.TemplateRef, error)
- type DirSource
- type Extract
- type Kind
- type Matcher
- type Pack
- type PackManifest
- type PackSource
- type Provenance
- type RequestSpec
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCapability ¶
func NewCapability(deps capkit.Deps) (capkit.Capability, error)
NewCapability builds the capability. When the host already provides a *Catalog as Deps.Templates it is reused so hot-reloaded packs are visible here too; otherwise an empty catalog is created.
func ValidatePack ¶
ValidatePack validates all templates and enforces unique IDs.
func ValidateTemplate ¶
ValidateTemplate checks the authoring contract.
Types ¶
type Capability ¶
type Capability struct {
// contains filtered or unexported fields
}
Capability exposes the template catalog as read-only tools. It never executes a template; execution belongs to the engine (verifykit/nucleikit).
func (*Capability) Manifest ¶
func (c *Capability) Manifest() capkit.Manifest
Manifest implements capkit.Capability.
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an in-memory, engine-neutral template index. It does not execute anything; engines consume TemplateRef values.
func NewCatalog ¶
func NewCatalog() *Catalog
func (*Catalog) AddPack ¶
AddPack validates and adds/replaces one pack. Replacing a pack removes only that pack's prior templates, so hot reload is atomic per pack.
func (*Catalog) Reload ¶
func (c *Catalog) Reload(ctx context.Context, sources ...PackSource) error
Reload loads every source and adds its pack. Any error leaves already-loaded packs in place; callers can treat this as best-effort.
func (*Catalog) Search ¶
func (c *Catalog) Search(_ context.Context, q capkit.TemplateQuery) ([]capkit.TemplateRef, error)
type DirSource ¶
DirSource loads a pack from an fs.FS rooted at Root. It supports pack.yaml, pack.yml and pack.json manifests, plus YAML/JSON template files.
type Extract ¶
type Extract struct {
Name string `yaml:"name" json:"name"`
Regex string `yaml:"regex" json:"regex"`
Group int `yaml:"group,omitempty" json:"group,omitempty"`
}
Extract pulls a value out of a matched response.
type Matcher ¶
type Matcher struct {
Type string `yaml:"type" json:"type"` // status | word | regex | dsl
Part string `yaml:"part,omitempty" json:"part,omitempty"`
Status []int `yaml:"status,omitempty" json:"status,omitempty"`
Words []string `yaml:"words,omitempty" json:"words,omitempty"`
Regex []string `yaml:"regex,omitempty" json:"regex,omitempty"`
DSL string `yaml:"dsl,omitempty" json:"dsl,omitempty"`
}
Matcher is a minimal, engine-neutral match rule. Engines may add their own richer matching; this covers the common status/word/regex/dsl cases.
type Pack ¶
type Pack struct {
Manifest PackManifest `json:"manifest"`
Templates []Template `json:"templates"`
Provenance Provenance `json:"provenance"`
Checksum string `json:"checksum,omitempty"`
}
Pack is a versioned, provenance-bearing set of templates.
type PackManifest ¶
type PackManifest struct {
Name string `yaml:"name" json:"name"`
Version string `yaml:"version" json:"version"`
Source string `yaml:"source,omitempty" json:"source,omitempty"`
License string `yaml:"license,omitempty" json:"license,omitempty"`
Checksum string `yaml:"checksum,omitempty" json:"checksum,omitempty"` // sha256:<hex>
Templates []string `yaml:"templates,omitempty" json:"templates,omitempty"`
}
PackManifest is the pack.yaml/pack.json contract. Templates may be glob patterns; when empty the loader walks the "templates" directory recursively.
type PackSource ¶
PackSource loads one pack. Implementations may read fs.FS, a directory, an artifact store or a remote URL. They must not execute templates.
type Provenance ¶
type Provenance struct {
Source string `json:"source,omitempty"`
Upstream string `json:"upstream,omitempty"`
License string `json:"license,omitempty"`
Commit string `json:"commit,omitempty"`
FetchedAt time.Time `json:"fetched_at,omitempty"`
}
Provenance records where a pack came from and under what license.
type RequestSpec ¶
type RequestSpec struct {
Method string `yaml:"method" json:"method"`
Path string `yaml:"path" json:"path"`
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
Body string `yaml:"body,omitempty" json:"body,omitempty"`
}
RequestSpec is the engine-neutral HTTP request description for kind=http.
type Template ¶
type Template struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
Kind Kind `yaml:"kind" json:"kind"`
Product []string `yaml:"product,omitempty" json:"product,omitempty"`
Fingerprint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
Severity string `yaml:"severity,omitempty" json:"severity,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
CVE string `yaml:"cve,omitempty" json:"cve,omitempty"`
Engine string `yaml:"engine,omitempty" json:"engine,omitempty"`
Request *RequestSpec `yaml:"request,omitempty" json:"request,omitempty"`
Matchers []Matcher `yaml:"matchers,omitempty" json:"matchers,omitempty"`
Extract []Extract `yaml:"extract,omitempty" json:"extract,omitempty"`
References []string `yaml:"references,omitempty" json:"references,omitempty"`
Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
// Runtime/provenance fields (not part of the authored template).
Path string `yaml:"-" json:"-"`
Pack string `yaml:"-" json:"-"`
Source string `yaml:"-" json:"-"`
Artifact []byte `yaml:"-" json:"-"`
}
Template is one predefined verification/exploitation recipe. It is engine neutral; the Artifact holds the original engine payload (nuclei YAML, shell spec, ...) while Request/Matchers describe the normalized http form.