cpe

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 53

Documentation

Index

Constants

View Source
const Any = ""

Variables

This section is empty.

Functions

func ValidateString

func ValidateString(cpeStr string) error

Types

type Attributes added in v0.104.0

type Attributes struct {
	Part      string
	Vendor    string
	Product   string
	Version   string
	Update    string
	Edition   string
	SWEdition string
	TargetSW  string
	TargetHW  string
	Other     string
	Language  string
}

func MustAttributes added in v0.104.0

func MustAttributes(cpeStr string) Attributes

func NewAttributes added in v0.104.0

func NewAttributes(cpeStr string) (Attributes, error)

NewAttributes will parse a formatted Attributes string and return a Attributes object. Some input, such as the existence of whitespace characters is allowed, however, a more strict validation is done after this sanitization process.

func NewWithAny added in v0.102.0

func NewWithAny() Attributes

func (Attributes) BindToFmtString added in v0.104.0

func (c Attributes) BindToFmtString() string

func (Attributes) String added in v0.104.0

func (c Attributes) String() string

type BySourceThenSpecificity added in v0.104.0

type BySourceThenSpecificity []CPE

func (BySourceThenSpecificity) Len added in v0.104.0

func (b BySourceThenSpecificity) Len() int

func (BySourceThenSpecificity) Less added in v0.104.0

func (b BySourceThenSpecificity) Less(i, j int) bool

func (BySourceThenSpecificity) Swap added in v0.104.0

func (b BySourceThenSpecificity) Swap(i, j int)

type BySpecificity

type BySpecificity []Attributes

func (BySpecificity) Len

func (c BySpecificity) Len() int

func (BySpecificity) Less

func (c BySpecificity) Less(i, j int) bool

func (BySpecificity) Swap

func (c BySpecificity) Swap(i, j int)

type CPE

type CPE struct {
	Attributes Attributes
	Source     Source
}

CPE contains the attributes of an NVD Attributes and a string describing where Syft got the Attributes, e.g. generated by heuristics vs looked up in the NVD Attributes dictionary

func Merge

func Merge(a, b []CPE) []CPE

Merge returns unique SourcedCPEs that are found in A or B Two SourcedCPEs are identical if their source and normalized string are identical

func Must

func Must(cpeStr string, source Source) CPE

Must returns a CPE or panics if the provided string is not valid

func New

func New(value string, source Source) (CPE, error)

type Source added in v0.104.0

type Source string
const (
	GeneratedSource           Source = "syft-generated"
	NVDDictionaryLookupSource Source = "nvd-cpe-dictionary"
	DeclaredSource            Source = "declared"
)

func (Source) String added in v0.104.0

func (c Source) String() string

Jump to

Keyboard shortcuts

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