Class: CvssSuite::Cvss2Base

Inherits:
CvssMetric show all
Defined in:
lib/cvss_suite/cvss2/cvss2_base.rb

Overview

This class represents a CVSS Base metric in version 2.

Instance Attribute Summary collapse

Attributes inherited from CvssMetric

#properties

Instance Method Summary collapse

Methods inherited from CvssMetric

#count, #explicitly_provided?, #initialize, #valid?

Constructor Details

This class inherits a constructor from CvssSuite::CvssMetric

Instance Attribute Details

#access_complexityObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 17

def access_complexity
  @access_complexity
end

#access_vectorObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 17

def access_vector
  @access_vector
end

#authenticationObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 17

def authentication
  @authentication
end

#availability_impactObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 17

def availability_impact
  @availability_impact
end

#confidentiality_impactObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 17

def confidentiality_impact
  @confidentiality_impact
end

#integrity_impactObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 17

def integrity_impact
  @integrity_impact
end

Instance Method Details

#exploitability_subscoreObject



42
43
44
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 42

def exploitability_subscore
  calc_exploitability
end

#impact_subscoreObject



38
39
40
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 38

def impact_subscore
  calc_impact
end

#score(sr_cr_score = 1, sr_ir_score = 1, sr_ar_score = 1) ⇒ Object

Returns the base score of the CVSS vector. The calculation is based on formula version 2.10 . See CVSS documentation for further information https://www.first.org/cvss/v2/guide#i3.2.1 .

BaseScore = ((0.6 x Impact) + (0.4 x Exploitability) - 1.5) x f(Impact), where f(Impact) = 0 when Impact is 0, else 1.176.

Takes Security Requirement Impacts for calculating environmental score.



28
29
30
31
32
33
34
35
36
# File 'lib/cvss_suite/cvss2/cvss2_base.rb', line 28

def score(sr_cr_score = 1, sr_ir_score = 1, sr_ar_score = 1)
  impact = calc_impact(sr_cr_score, sr_ir_score, sr_ar_score)

  exploitability = calc_exploitability

  additional_impact = (impact.zero? ? 0 : 1.176)

  ((0.6 * impact) + (0.4 * exploitability) - 1.5) * additional_impact
end