CVSS2/3/4 library with interactive calculator for Python 2 and Python 3
Project description
This Python package contains CVSS v2, v3 and v4 computation utilities and interactive calculator (for v2 and v3 only) compatible with both Python 2 and Python 3.
The library is tested on all currently-supported Python versions available via GitHub Actions (with the exception of Python 2.7, which is EOL but still tested against), but it is simple enough to run on even older versions.
Installation
# pip install cvss
Usage
Library
from cvss import CVSS2, CVSS3, CVSS4
vector = 'AV:L/AC:L/Au:M/C:N/I:P/A:C/E:U/RL:W/RC:ND/CDP:L/TD:H/CR:ND/IR:ND/AR:M'
c = CVSS2(vector)
print(vector)
print(c.clean_vector())
print(c.scores())
print()
vector = 'CVSS:3.0/S:C/C:H/I:H/A:N/AV:P/AC:H/PR:H/UI:R/E:H/RL:O/RC:R/CR:H/IR:X/AR:X/MAC:H/MPR:X/MUI:X/MC:L/MA:X'
c = CVSS3(vector)
print(vector)
print(c.clean_vector())
print(c.scores())
print(c.severities())
print()
vector = 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:N'
c = CVSS4(vector)
print(vector)
print(c.base_score)
print(c.severity)
Sample output:
AV:L/AC:L/Au:M/C:N/I:P/A:C/E:U/RL:W/RC:ND/CDP:L/TD:H/CR:ND/IR:ND/AR:M AV:L/AC:L/Au:M/C:N/I:P/A:C/E:U/RL:W/CDP:L/TD:H/AR:M (5.0, 4.0, 4.6) CVSS:3.0/S:C/C:H/I:H/A:N/AV:P/AC:H/PR:H/UI:R/E:H/RL:O/RC:R/CR:H/IR:X/AR:X/MAC:H/MPR:X/MUI:X/MC:L/MA:X CVSS:3.0/AV:P/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:N/E:H/RL:O/RC:R/CR:H/MAC:H/MC:L (6.5, 6.0, 5.3) ('Medium', 'Medium', 'Medium') CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:N 9.9 Critical
Interactive calculator
For interactive calculator run the following:
$ cvss_calculator
For help on the calculator options run:
$ cvss_calculator --help
Testing
For extensive testing, the test vectors were generated using official JavaScript generators and cvsslib.
To run all tests using all supported versions of Python 2 and Python 3 installed:
$ tox $ tox -e py311 # Run tests using a specific version of Python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cvss-3.3.tar.gz
.
File metadata
- Download URL: cvss-3.3.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae097183ee58b02262ab2291d27857ca3d0a7c4242b9b076c6bf537e6239fbc0 |
|
MD5 | ba3f201a65a1839db818a36af14fcab7 |
|
BLAKE2b-256 | b8f38893d8c4ea780e51eb22bc94a5959a2836d7eb74fe7c24b98bd1b2c74d9c |
File details
Details for the file cvss-3.3-py2.py3-none-any.whl
.
File metadata
- Download URL: cvss-3.3-py2.py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc7326afc7585cc63d0a6ca74dab27d74aa2bc99f5f3d5d4bc4d94a3c22bc0a1 |
|
MD5 | 0cac19f85a7a25372257c5120e214f2b |
|
BLAKE2b-256 | f26b67cd7bddf7a85d795929397cd0a0181c0ee064e16ddb137b788e52e63742 |