Skip to main content

CVSS2/3 library with interactive calculator for Python 2 and Python 3

Project description

This Python package contains CVSS v2 and v3 computation utilities and interactive calculator 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


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())

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')

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 use the following script on a system with both Python 2 and Python 3 installed:

$ cd tests
$ bash run_tests.sh

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-2.3.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

cvss-2.3-py2.py3-none-any.whl (20.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: cvss-2.3.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.5

File hashes

Hashes for cvss-2.3.tar.gz
Algorithm Hash digest
SHA256 fc22c9da2e7b93e0476cbea1279c95e7be08a3413e2d946686f0271501a24140
MD5 d4aa9777028b38647e8e04ca2b4dcbed
BLAKE2b-256 9bf8e0d929b2a37dd32cdf9f7aba88609a99a4f82b0fd961214466fbda8ee756

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cvss-2.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.5

File hashes

Hashes for cvss-2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0b6b6b78e140f5abbaf75a48d77e970afe6da17763f568a2dca32b23e986a336
MD5 d0064cd1288bdf0c27329c757c51e265
BLAKE2b-256 9696474c8b657040a97d9b4ca7d5b59a56897b8536c8a66400ef57e52971777e

See more details on using hashes here.

Supported by

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