Skip to content

🔎 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 ​

FlagDefaultDescription
--longfalseshow 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 ​

bash
cvss get "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H" AV
# Output:
# N
bash
cvss get --long "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H" AV
# Output:
# Network

get 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 ​

go
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)          // Network

GetMetricValue(shortName string) (rune, string, error) is defined on *cvss.Cvss3x.

  • map — output the whole vector as key=value pairs
  • groups — inspect metrics grouped by Base / Temporal / Environmental
  • enumerate — list valid values and scores for a metric

Released under the MIT License.