cvss


Namecvss JSON
Version 3.0 PyPI version JSON
download
home_pagehttps://github.com/RedHatProductSecurity/cvss
SummaryCVSS2/3/4 library with interactive calculator for Python 2 and Python 3
upload_time2024-01-24 12:41:33
maintainer
docs_urlNone
authorStanislav Kontar, Red Hat Product Security
requires_python
licenseLGPLv3+
keywords security cvss score calculator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            CVSS
====

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
~~~~~~~

.. code-block:: python

    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 <https://github.com/ctxis/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



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RedHatProductSecurity/cvss",
    "name": "cvss",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "security cvss score calculator",
    "author": "Stanislav Kontar, Red Hat Product Security",
    "author_email": "skontar@redhat.com",
    "download_url": "",
    "platform": null,
    "description": "CVSS\n====\n\nThis Python package contains CVSS v2, v3 and v4 computation utilities and\ninteractive calculator (for v2 and v3 only) compatible with both Python 2 and Python 3.\n\nThe library is tested on all currently-supported Python versions available\nvia GitHub Actions (with the exception of Python 2.7, which is EOL but\nstill tested against), but it is simple enough to run on even older versions.\n\nInstallation\n------------\n\n::\n\n    # pip install cvss\n\nUsage\n-----\n\nLibrary\n~~~~~~~\n\n.. code-block:: python\n\n    from cvss import CVSS2, CVSS3, CVSS4\n\n\n    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'\n    c = CVSS2(vector)\n    print(vector)\n    print(c.clean_vector())\n    print(c.scores())\n\n    print()\n\n    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'\n    c = CVSS3(vector)\n    print(vector)\n    print(c.clean_vector())\n    print(c.scores())\n    print(c.severities())\n\n    print()\n\n    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'\n    c = CVSS4(vector)\n    print(vector)\n    print(c.base_score)\n    print(c.severity)\n\nSample output:\n\n::\n\n   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\n   AV:L/AC:L/Au:M/C:N/I:P/A:C/E:U/RL:W/CDP:L/TD:H/AR:M\n   (5.0, 4.0, 4.6)\n\n   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\n   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\n   (6.5, 6.0, 5.3)\n   ('Medium', 'Medium', 'Medium')\n\n   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\n   9.9\n   Critical\n\nInteractive calculator\n~~~~~~~~~~~~~~~~~~~~~~\n\nFor interactive calculator run the following:\n\n::\n\n    $ cvss_calculator\n\nFor help on the calculator options run:\n\n::\n\n    $ cvss_calculator --help\n\nTesting\n-------\n\nFor extensive testing, the test vectors were generated using official\nJavaScript generators and `cvsslib <https://github.com/ctxis/cvsslib>`_.\n\nTo run all tests using all supported versions of Python 2 and Python 3 installed:\n\n::\n\n    $ tox\n    $ tox -e py311   # Run tests using a specific version of Python\n\n\n",
    "bugtrack_url": null,
    "license": "LGPLv3+",
    "summary": "CVSS2/3/4 library with interactive calculator for Python 2 and Python 3",
    "version": "3.0",
    "project_urls": {
        "CI": "https://github.com/RedHatProductSecurity/cvss/actions",
        "Homepage": "https://github.com/RedHatProductSecurity/cvss",
        "Issues": "https://github.com/RedHatProductSecurity/cvss/issues",
        "Releases": "https://github.com/RedHatProductSecurity/cvss/releases",
        "Source code": "https://github.com/RedHatProductSecurity/cvss"
    },
    "split_keywords": [
        "security",
        "cvss",
        "score",
        "calculator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b588fd085ff357815351ae72a867588bc3ee38f24cfeca251d669ed5adff570",
                "md5": "62060a29b46fba7983bbbd527ba00938",
                "sha256": "705995aa6f99efdd600f83997c78b625bc81be0603ec00a91465ad2eb613cd7b"
            },
            "downloads": -1,
            "filename": "cvss-3.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62060a29b46fba7983bbbd527ba00938",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 26729,
            "upload_time": "2024-01-24T12:41:33",
            "upload_time_iso_8601": "2024-01-24T12:41:33.068782Z",
            "url": "https://files.pythonhosted.org/packages/1b/58/8fd085ff357815351ae72a867588bc3ee38f24cfeca251d669ed5adff570/cvss-3.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-24 12:41:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RedHatProductSecurity",
    "github_project": "cvss",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "cvss"
}
        
Elapsed time: 0.17769s