Class: CvssSuite::Cvss31Base

Inherits:
CvssMetric show all
Defined in:
lib/cvss_suite/cvss31/cvss31_base.rb

Overview

This class represents a CVSS Base metric in version 3.1.

Instance Attribute Summary collapse

Attributes inherited from CvssMetric

#properties

Instance Method Summary collapse

Methods inherited from CvssMetric

#count, #initialize, #valid?

Constructor Details

This class inherits a constructor from CvssSuite::CvssMetric

Instance Attribute Details

#attack_complexityObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def attack_complexity
  @attack_complexity
end

#attack_vectorObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def attack_vector
  @attack_vector
end

#availabilityObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def availability
  @availability
end

#confidentialityObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def confidentiality
  @confidentiality
end

#integrityObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def integrity
  @integrity
end

#privileges_requiredObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def privileges_required
  @privileges_required
end

#scopeObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def scope
  @scope
end

#user_interactionObject (readonly)

Property of this metric



17
18
19
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 17

def user_interaction
  @user_interaction
end

Instance Method Details

#exploitability_subscoreObject



39
40
41
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 39

def exploitability_subscore
  calc_exploitability
end

#impact_subscoreObject



35
36
37
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 35

def impact_subscore
  calc_impact
end

#scoreObject

Returns score of this metric



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cvss_suite/cvss31/cvss31_base.rb', line 22

def score
  exploitability = calc_exploitability
  impact_sub_score = calc_impact

  return 0 if impact_sub_score <= 0

  if @scope.selected_value[:name] == 'Changed'
    [10, 1.08 * (impact_sub_score + exploitability)].min
  else
    [10, impact_sub_score + exploitability].min
  end
end