signature

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Evidence

type Evidence struct {
	Source  string `json:"source"`
	Matcher string `json:"matcher"`
	Pattern string `json:"pattern,omitempty"`
	Value   string `json:"value,omitempty"`
}

type HTTPMatcher

type HTTPMatcher struct {
	Status  []int           `yaml:"status" json:"status,omitempty"`
	Body    TextMatcher     `yaml:"body" json:"body,omitempty"`
	Title   TextMatcher     `yaml:"title" json:"title,omitempty"`
	Headers []HeaderMatcher `yaml:"headers" json:"headers,omitempty"`
}

func (HTTPMatcher) Empty

func (m HTTPMatcher) Empty() bool

func (HTTPMatcher) Match

func (m HTTPMatcher) Match(responses []HTTPObservation) []Evidence

type HTTPObservation

type HTTPObservation struct {
	URL        string
	StatusCode int
	Headers    map[string][]string
	Body       string
	Title      string
	Error      string
}

type HeaderMatcher

type HeaderMatcher struct {
	Name     string   `yaml:"name" json:"name"`
	Contains []string `yaml:"contains" json:"contains,omitempty"`
	Equals   []string `yaml:"equals" json:"equals,omitempty"`
	Prefix   []string `yaml:"prefix" json:"prefix,omitempty"`
	Suffix   []string `yaml:"suffix" json:"suffix,omitempty"`
	Regex    []string `yaml:"regex" json:"regex,omitempty"`
}

type MatchResult

type MatchResult struct {
	Matched  bool       `json:"matched"`
	Partial  bool       `json:"partial"`
	Groups   []string   `json:"groups,omitempty"`
	Evidence []Evidence `json:"evidence,omitempty"`
}

type Matchers

type Matchers struct {
	CNAME    TextMatcher `yaml:"cname" json:"cname,omitempty"`
	NS       TextMatcher `yaml:"ns" json:"ns,omitempty"`
	Dangling bool        `yaml:"dangling" json:"dangling,omitempty"`
	HTTP     HTTPMatcher `yaml:"http" json:"http,omitempty"`
}

type Signature

type Signature struct {
	ID          string   `yaml:"id" json:"id"`
	Name        string   `yaml:"name" json:"name"`
	Service     string   `yaml:"service" json:"service"`
	Severity    string   `yaml:"severity" json:"severity"`
	Confidence  string   `yaml:"confidence" json:"confidence"`
	Description string   `yaml:"description" json:"description"`
	Takeover    bool     `yaml:"takeover" json:"takeover"`
	Requires    []string `yaml:"requires" json:"requires,omitempty"`
	Matchers    Matchers `yaml:"matchers" json:"matchers"`
	References  []string `yaml:"references" json:"references,omitempty"`
	Source      string   `yaml:"-" json:"source,omitempty"`
}

func LoadFS

func LoadFS(fsys fs.FS, root string) ([]Signature, error)

func LoadPaths

func LoadPaths(paths []string) ([]Signature, error)

func Merge

func Merge(base, overrides []Signature) []Signature

func (Signature) Match

func (s Signature) Match(surface Surface) MatchResult

func (Signature) Validate

func (s Signature) Validate() error

type Surface

type Surface struct {
	Target      string
	CNAMEs      []string
	Nameservers []string
	Addresses   []string
	Dangling    bool
	HTTP        []HTTPObservation
}

type TextMatcher

type TextMatcher struct {
	Contains []string `yaml:"contains" json:"contains,omitempty"`
	Equals   []string `yaml:"equals" json:"equals,omitempty"`
	Prefix   []string `yaml:"prefix" json:"prefix,omitempty"`
	Suffix   []string `yaml:"suffix" json:"suffix,omitempty"`
	Regex    []string `yaml:"regex" json:"regex,omitempty"`
}

func (TextMatcher) Empty

func (m TextMatcher) Empty() bool

func (TextMatcher) Match

func (m TextMatcher) Match(source string, values []string) []Evidence

Jump to

Keyboard shortcuts

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