Coder Social home page Coder Social logo

jeffreylmelvin / cvss Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redhatproductsecurity/cvss

0.0 1.0 0.0 9.84 MB

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

License: GNU Lesser General Public License v3.0

Python 99.88% Shell 0.12%

cvss's Introduction

CVSS

Travis CI test status

This Python package contains CVSS v2 and v3 computation utilities and interactive calculator compatible with both Python 2 and Python 3.

It is tested on Python versions supported by Travis, 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

cvss's People

Contributors

skontar avatar iamleot avatar saigono avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.