Class: CvssSuite::Cvss2
- Inherits:
-
Cvss31AndBefore
- Object
- Cvss
- Cvss31AndBefore
- CvssSuite::Cvss2
- Defined in:
- lib/cvss_suite/cvss2/cvss2.rb
Overview
This class represents a CVSS vector in version 2.
Instance Attribute Summary
Attributes inherited from Cvss31AndBefore
Attributes inherited from Cvss
Instance Method Summary collapse
-
#base_score ⇒ Object
Returns the Base Score of the CVSS vector.
-
#environmental_score ⇒ Object
Returns the Environmental Score of the CVSS vector.
-
#severity ⇒ Object
Returns the severity of the CVSSv2 base score.
-
#temporal_score ⇒ Object
Returns the Temporal Score of the CVSS vector.
-
#version ⇒ Object
Returns the Version of the CVSS vector.
Methods inherited from Cvss31AndBefore
#initialize, #overall_score, #valid?
Methods inherited from Cvss
Constructor Details
This class inherits a constructor from CvssSuite::Cvss31AndBefore
Instance Method Details
#base_score ⇒ Object
Returns the Base Score of the CVSS vector.
46 47 48 49 |
# File 'lib/cvss_suite/cvss2/cvss2.rb', line 46 def base_score check_validity @base.score.round(1) end |
#environmental_score ⇒ Object
Returns the Environmental Score of the CVSS vector.
59 60 61 62 63 64 |
# File 'lib/cvss_suite/cvss2/cvss2.rb', line 59 def environmental_score check_validity return temporal_score unless @environmental.valid? (@environmental.score @base, @temporal.score).round(1) end |
#severity ⇒ Object
Returns the severity of the CVSSv2 base score. https://nvd.nist.gov/vuln-metrics/cvss
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cvss_suite/cvss2/cvss2.rb', line 27 def severity check_validity score = base_score case score when 0.0..3.9 'Low' when 4.0..6.9 'Medium' when 7.0..10.0 'High' else 'None' end end |
#temporal_score ⇒ Object
Returns the Temporal Score of the CVSS vector.
53 54 55 |
# File 'lib/cvss_suite/cvss2/cvss2.rb', line 53 def temporal_score (base_score * @temporal.score.to_d).round(1).to_f end |
#version ⇒ Object
Returns the Version of the CVSS vector.
21 22 23 |
# File 'lib/cvss_suite/cvss2/cvss2.rb', line 21 def version 2 end |