1
1
<h1 align =" center " >cvss.js by <a href =" https://turingpoint.eu " target =" _blank " >turingpoint.</a ></h1 >
2
2
<p >
3
- <img alt =" Version " src =" https://img.shields.io/badge/version-1.4.7 -blue.svg?cacheSeconds=2592000 " />
3
+ <img alt =" Version " src =" https://img.shields.io/badge/version-1.5.0 -blue.svg?cacheSeconds=2592000 " />
4
4
<a href =" # " target =" _blank " >
5
5
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
6
6
</a >
@@ -40,27 +40,27 @@ After importing the library, the CVSS function must first be called with the vec
40
40
const vector1 = CVSS (" CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:N/I:L/A:L" );
41
41
// Vector with temporal score
42
42
const vector2 = CVSS (
43
- " CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L/E:U/RL:T/RC:R"
43
+ " CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L/E:U/RL:T/RC:R"
44
44
);
45
45
// Vector with environmental score
46
46
const vector3 = CVSS (
47
- " CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N/CR:M/IR:H/AR:M/MAV:N/MAC:H/MPR:L/MUI:N/MS:C/MC:N/MI:L/MA:L"
47
+ " CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N/CR:M/IR:H/AR:M/MAV:N/MAC:H/MPR:L/MUI:N/MS:C/MC:N/MI:L/MA:L"
48
48
);
49
49
```
50
50
51
51
It is possible to pass in an object as well
52
52
53
53
``` js
54
54
const vectorObject = {
55
- CVSS : " 3.0" ,
56
- AV : " N" ,
57
- AC : " H" ,
58
- PR : " H" ,
59
- UI : " R" ,
60
- S : " U" ,
61
- C : " H" ,
62
- I : " N" ,
63
- A : " N" ,
55
+ CVSS : " 3.0" ,
56
+ AV : " N" ,
57
+ AC : " H" ,
58
+ PR : " H" ,
59
+ UI : " R" ,
60
+ S : " U" ,
61
+ C : " H" ,
62
+ I : " N" ,
63
+ A : " N" ,
64
64
};
65
65
66
66
console .log (CVSS (vectorObject).vector ); // "CVSS:3.0/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N"
@@ -71,14 +71,14 @@ To get the scores, simply call the respective function.
71
71
``` js
72
72
// Create a vector
73
73
const vector = CVSS (
74
- " CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N/E:P/RL:O/CR:M/IR:H/AR:M/MAV:N/MAC:H/MPR:L/MUI:N/MS:C/MC:N/MI:L/MA:L"
74
+ " CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N/E:P/RL:O/CR:M/IR:H/AR:M/MAV:N/MAC:H/MPR:L/MUI:N/MS:C/MC:N/MI:L/MA:L"
75
75
);
76
76
77
77
console .log (vector .getScore ()); // 3.6
78
78
console .log (vector .getTemporalScore ()); // 3.3
79
79
console .log (vector .getEnvironmentalScore ()); // 5.1
80
- console .log (vector .getImpactSubScore ()) // 2.5
81
- console .log (vector .getExploitabilitySubScore ()) // 1
80
+ console .log (vector .getImpactSubScore ()); // 2.5
81
+ console .log (vector .getExploitabilitySubScore ()); // 1
82
82
```
83
83
84
84
Sometimes it is useful to get a qualitative rating of a score
@@ -105,7 +105,7 @@ The following functions are suitable for displaying the vector in a human-readab
105
105
106
106
``` js
107
107
const vector = CVSS (
108
- " CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L/E:U/RL:T/RC:R/MAC:X/MUI:X/MA:X/MI:X"
108
+ " CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L/E:U/RL:T/RC:R/MAC:X/MUI:X/MA:X/MI:X"
109
109
);
110
110
111
111
console .log (vector .getVectorObject ()); // { CVSS: "3.0", AV: "N", AC: "H", PR: "L", UI: "R", S: "C", C: "L", I: "L", A: "L", E: "U", RL: "T", RC: "R", CR: "X", IR: "X", AR: "X", MAV: "X", MAC: "X", MPR: "X", MUI: "X", MS: "X" , MC: "X", MI: "X", MA: "X" }
@@ -235,7 +235,7 @@ To update a vector's metric:
235
235
236
236
``` js
237
237
const vector = CVSS (
238
- " CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N/RL:X/RC:X"
238
+ " CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N/RL:X/RC:X"
239
239
).updateVectorValue (" AV" , " L" );
240
240
console .log (vector); // "CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N"
241
241
```
0 commit comments