cpe

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Any = ""

Variables

This section is empty.

Functions

func ValidateString

func ValidateString(cpeStr string) error

Types

type Attributes

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

func MustAttributes(cpeStr string) Attributes

func NewAttributes

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

func NewWithAny() Attributes

func (Attributes) BindToFmtString

func (c Attributes) BindToFmtString() string

func (Attributes) String

func (c Attributes) String() string

type BySourceThenSpecificity

type BySourceThenSpecificity []CPE

func (BySourceThenSpecificity) Len

func (b BySourceThenSpecificity) Len() int

func (BySourceThenSpecificity) Less

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

func (BySourceThenSpecificity) Swap

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

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

func (Source) String

func (c Source) String() string

Jump to

Keyboard shortcuts

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