Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cvss-3.1.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cvss-3.1-py2.py3-none-any.whl (30.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cvss-3.1.tar.gz.

File metadata

  • Download URL: cvss-3.1.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for cvss-3.1.tar.gz
Algorithm Hash digest
SHA256 54789edd255d1bc26cc04919f5795e250e9ce2da33b2fc0e8e709f22cb88c5fc
MD5 408068c0d5b4eeec8a22a335e76b4754
BLAKE2b-256 f0c13ec60fa39d598bf652871f012cf8fd7e85f80ca6b2243c312c84a96a1314

See more details on using hashes here.

File details

Details for the file cvss-3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: cvss-3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for cvss-3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 092dafc14f9f1c1ac09e25d0d38410e178cf0009479faecff7f585c968f21688
MD5 12c262d3e441768a8510aded8d3175fa
BLAKE2b-256 64c9c3d7bc9292f1c8ad7617a26e697069df1fa5613d46b482901140f21220cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page