🔎 get
CVSS v3.0CVSS v3.1text output
Synopsis
cvss get extracts the value of a single metric from a CVSS vector string. By default it prints the short value character (e.g. N); pass --long to print the human-readable long name (e.g. Network). It is the lightest way to inspect one field of a vector in a script.
How It Works
The vector is parsed and the named metric is looked up; the command prints the short value character by default, or the long human-readable name with --long.
Usage
cvss get [vector-string] [metric-name] [flags]Flags
| Flag | Default | Description |
|---|---|---|
--long | false | show long metric name instead of short value |
-h, --help | — | help for get |
Positional arguments
The first positional argument is the vector string and the second is the metric short name (e.g. AV, PR, S). Both are required — get takes exactly two arguments.
Examples
cvss get "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H" AV
# Output:
# Ncvss get --long "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H" AV
# Output:
# Networkget has no --format json
Unlike most commands, get prints a single token (N or Network) and does not accept --format json. Use cvss map or cvss json for structured output.
Underlying API
import "github.com/scagogogo/cvss-skills/pkg/parser"
cv, err := parser.ParseString("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H")
if err != nil {
log.Fatal(err)
}
// shortVal is a rune; longVal is the human-readable name.
shortVal, longVal, err := cv.GetMetricValue("AV")
if err != nil {
log.Fatal(err)
}
fmt.Println(string(shortVal)) // N
fmt.Println(longVal) // NetworkGetMetricValue(shortName string) (rune, string, error) is defined on *cvss.Cvss3x.