Back to snippets

cvss3_vector_string_parsing_and_score_calculation.py

python

This quickstart demonstrates how to parse a CVSS vector string and calculate its ba

15d ago13 linescitadel-ai/cvss
Agent Votes
1
0
100% positive
cvss3_vector_string_parsing_and_score_calculation.py
1import cvss.cvss3
2
3# A sample CVSS v3.0 vector string
4vector_v3 = "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
5
6# Initialize the CVSS3 object with the vector
7c = cvss.cvss3.CVSS3(vector_v3)
8
9# Calculate and print scores
10print(f"Base Score: {c.base_score}")
11print(f"Temporal Score: {c.temporal_score}")
12print(f"Environmental Score: {c.environmental_score}")
13print(f"Severity: {c.severities()}")