Skip to content

📋 enumerate ​

CVSS v3.0CVSS v3.1text + json

Synopsis ​

cvss enumerate is a reference command: it lists all CVSS v3.x metrics, their valid values, and per-value scores, grouped by Base / Temporal / Environmental. Use --metric to focus on one metric, or --validate-value to check whether a METRIC:VALUE pair is valid.

How It Works ​

With no arguments the command lists every CVSS v3.x metric with valid values and per-value scores; --metric focuses on one metric, and --validate-value checks a single METRIC:VALUE pair.

Usage ​

cvss enumerate [flags]

Flags ​

FlagDefaultDescription
--format stringtextoutput format: text or json
--metric string""show details for a specific metric (e.g. AV)
--validate-value string""validate a metric:value pair (e.g. AV:N)
-h, --help—help for enumerate

Examples ​

bash
cvss enumerate --metric AV
# Output:
# AV (Attack Vector) [Base]:
#   N = Network (score: 0.85)
#   A = Adjacent (score: 0.62)
#   L = Local (score: 0.55)
#   P = Physical (score: 0.20)
bash
cvss enumerate
bash
cvss enumerate --validate-value AV:N
bash
cvss enumerate --format json

--validate-value exit code

--validate-value exits 0 when the pair is valid and 1 when invalid (printing Invalid: X is not a valid value for METRIC). This makes it usable as a guard in scripts.

Underlying API ​

go
import "github.com/scagogogo/cvss-skills/pkg/cvss"

// List every metric, grouped by Base/Temporal/Environmental.
metrics := cvss.ListAllMetrics() // []MetricInfo
for _, m := range metrics {
    fmt.Print(m.String())
}

// Focus on one metric.
info, err := cvss.GetMetricInfo("AV") // (MetricInfo, error)
if err != nil {
    log.Fatal(err)
}
fmt.Print(info.String())

// Check a single value (rune).
valid := cvss.IsValidMetricValue("AV", 'N') // bool

The three building blocks are ListAllMetrics() []MetricInfo, GetMetricInfo(shortName string) (MetricInfo, error), and IsValidMetricValue(shortName string, value rune) bool.

  • validate — validate a whole vector string
  • get — read one metric's value from a vector
  • build — assemble a vector from metric flags

Released under the MIT License.