Skip to content

✏️ modify ​

✏️ Modify · 🟢 stable

Synopsis ​

cvss modify takes an existing CVSS vector and applies metric changes supplied as flags (--AV=L, --S=C, …), then outputs a new vector. The original is never mutated. Pass --score to also print the recalculated score of the result.

How It Works ​

Each --flag is applied in turn via SetMetricValue, which returns a new copy so the original vector is never mutated; the final copy is rendered back to a vector string (with an optional recalculated score).

Usage ​

bash
cvss modify [vector-string] [flags]

Flags ​

FlagTypeDefaultDescription
--AstringAvailability (H/L/N)
--ACstringAttack Complexity (L/H)
--ARstringAvailability Requirement (X/H/M/L)
--AVstringAttack Vector (N/A/L/P)
--CstringConfidentiality (H/L/N)
--CRstringConfidentiality Requirement (X/H/M/L)
--EstringExploit Code Maturity (X/U/P/F/H)
--IstringIntegrity (H/L/N)
--IRstringIntegrity Requirement (X/H/M/L)
--MAstringModified Availability (X/H/L/N)
--MACstringModified Attack Complexity (X/L/H)
--MAVstringModified Attack Vector (X/N/A/L/P)
--MCstringModified Confidentiality (X/H/L/N)
--MIstringModified Integrity (X/H/L/N)
--MPRstringModified Privileges Required (X/N/L/H)
--MSstringModified Scope (X/U/C)
--MUIstringModified User Interaction (X/N/R)
--PRstringPrivileges Required (N/L/H)
--RCstringReport Confidence (X/U/R/C)
--RLstringRemediation Level (X/O/T/W/U)
--SstringScope (U/C)
--UIstringUser Interaction (N/R)
--formatstringtextOutput format: text or json
-h, --helpboolfalseHelp for modify
--scoreboolfalseShow the calculated score

Only pass the metrics you change

Flags you omit leave the original metric untouched, so you can change a single value (e.g. --AV=L) without re-specifying the rest.

Examples ​

bash
cvss modify "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H" --AV=L
text
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
bash
cvss modify --AV=L "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
text
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Flags may appear before or after the vector

Both cvss modify "<vec>" --AV=L and cvss modify --AV=L "<vec>" work — Cobra flags are position-independent. Use whichever reads better in your script.

Underlying API ​

Parses the vector with parser.ParseString, then calls cv.SetMetricValue(metric, rune) once per supplied flag, accumulating into a new *Cvss3x. The result is printed with cv.String() (and scored via a calculator when --score is set).

go
import (
    "fmt"

    "github.com/scagogogo/cvss-skills/pkg/cvss"
    "github.com/scagogogo/cvss-skills/pkg/parser"
)

cv, err := parser.ParseString("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H")
if err != nil {
    log.Fatal(err)
}

// change AV to L (returns a new *Cvss3x; original untouched)
cv, err = cv.SetMetricValue("AV", 'L')
if err != nil {
    log.Fatal(err)
}
fmt.Println(cv.String()) // CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • build — construct a vector from scratch instead of editing one
  • score — score the modified result
  • convert — change the CVSS version instead of the metrics
  • SetMetricValue — Go SDK reference

Released under the MIT License.