1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
"""
This is a simple test against cvsslib from https://pypi.python.org/pypi/cvsslib .
Runs only with Python 3 because cvsslib does not support Python 2.
"""
import cvsslib
import cvss
vector_string = "AV:L/AC:M/Au:N/C:N/I:N/A:N/E:F/RL:W/RC:C/TD:L/CR:H/IR:ND"
result = cvss.CVSS2(vector_string).scores()
expected = cvsslib.vector.calculate_vector(vector_string, module=cvsslib.cvss2)
print("CVSS2")
print(expected)
print(result)
print()
vector_string = "AV:L/AC:M/Au:S/C:N/I:P/A:C/E:U/RL:OF/RC:UR/CDP:N/TD:L/CR:H/IR:H/AR:H"
result = cvss.CVSS2(vector_string).scores()
expected = cvsslib.vector.calculate_vector(vector_string, module=cvsslib.cvss2)
print("CVSS2")
print(expected)
print(result)
print()
vector_string = (
"AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/"
"E:P/RL:W/CR:X/IR:M/AR:H/MAV:N/MAC:H/MPR:L/MUI:N/MS:X/MC:N/MI:N/MA:X"
)
result = cvss.CVSS3(vector_string).scores()
expected = cvsslib.vector.calculate_vector(vector_string, module=cvsslib.cvss3)
print("CVSS3")
print(expected)
print(result)
|