gocvss30

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCVSSHeader  = errors.New("invalid CVSS v3.0 header")
	ErrTooShortVector     = errors.New("too short vector")
	ErrInvalidMetricValue = errors.New("invalid metric value")
	ErrOutOfBoundsScore   = errors.New("out of bounds score")
)

Functions

func Rating

func Rating(score float64) (string, error)

Rating returns the verbose for a given rating. It does not check wether the number of decimal is valid, as it can differ due to binary imprecisions, and such behaviour is not enforced by the specification.

Types

type CVSS30

type CVSS30 struct {
	// contains filtered or unexported fields
}

CVSS30 embeds all the metric values defined by the CVSS v3.1 specification.

func ParseVector

func ParseVector(vector string) (*CVSS30, error)

ParseVector parses a given vector string, validates it and returns a CVSS30.

func (CVSS30) BaseScore

func (cvss30 CVSS30) BaseScore() float64

BaseScore returns the CVSS v3.0's base score.

func (CVSS30) EnvironmentalScore

func (cvss30 CVSS30) EnvironmentalScore() float64

EnvironmentalScore returns the CVSS v3.1's environmental score.

func (CVSS30) Exploitability added in v0.4.0

func (cvss30 CVSS30) Exploitability() float64

func (CVSS30) Get

func (cvss30 CVSS30) Get(abv string) (r string, err error)

Get returns the value of the given metric abbreviation.

func (CVSS30) Impact added in v0.4.0

func (cvss30 CVSS30) Impact() float64

func (*CVSS30) Set

func (cvss30 *CVSS30) Set(abv string, value string) error

Set sets the value of the given metric abbreviation.

func (CVSS30) TemporalScore

func (cvss30 CVSS30) TemporalScore() float64

TemporalScore returns the CVSS v3.1's temporal score.

func (CVSS30) Vector

func (cvss30 CVSS30) Vector() string

Vector returns the CVSS v3.1 vector string representation.

type ErrDefinedN

type ErrDefinedN struct {
	Abv string
}

ErrDefinedN is an error returned by ParseVector when the given vector has a metric abbreviation defined multiple times.

func (ErrDefinedN) Error

func (err ErrDefinedN) Error() string

type ErrInvalidMetric

type ErrInvalidMetric struct {
	Abv string
}

ErrInvalidMetric is an error returned when a given metric does not exist.

func (ErrInvalidMetric) Error

func (err ErrInvalidMetric) Error() string

type ErrMissing added in v0.4.0

type ErrMissing struct {
	Abv string
}

ErrMissing is an error returned by ParseVector when the given vector have missing base score attributes.

func (ErrMissing) Error added in v0.4.0

func (err ErrMissing) Error() string

Jump to

Keyboard shortcuts

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