class CvssSuite::Cvss2Environmental

This class represents a CVSS Environmental metric in version 2.

Attributes

collateral_damage_potential[R]

Property of this metric

security_requirements_ar[R]

Property of this metric

security_requirements_cr[R]

Property of this metric

security_requirements_ir[R]

Property of this metric

target_distribution[R]

Property of this metric

Public Instance Methods

score(base, temporal_score) click to toggle source

Returns score of this metric

# File lib/cvss_suite/cvss2/cvss2_environmental.rb, line 25
def score(base, temporal_score)
  base_score = base.score(@security_requirements_cr.score,
                          @security_requirements_ir.score,
                          @security_requirements_ar.score).round(1)

  adjusted_temporal = (base_score * temporal_score).round(1)
  (adjusted_temporal + (10 - adjusted_temporal) * @collateral_damage_potential.score) * @target_distribution.score
end

Private Instance Methods

init_properties() click to toggle source
# File lib/cvss_suite/cvss2/cvss2_environmental.rb, line 36
def init_properties
  @properties.push(@collateral_damage_potential =
                     CvssProperty.new(name: 'Collateral Damage Potential', abbreviation: 'CDP', position: [6, 9],
                                      values: [{ name: 'None', abbreviation: 'N', weight: 0.0 },
                                               { name: 'Low', abbreviation: 'L', weight: 0.1 },
                                               { name: 'Low-Medium', abbreviation: 'LM', weight: 0.3 },
                                               { name: 'Medium-High', abbreviation: 'MH', weight: 0.4 },
                                               { name: 'High', abbreviation: 'H', weight: 0.5 },
                                               { name: 'Not Defined', abbreviation: 'ND', weight: 0.0 }]))
  @properties.push(@target_distribution =
                     CvssProperty.new(name: 'Target Distribution', abbreviation: 'TD', position: [7, 10],
                                      values: [{ name: 'None', abbreviation: 'N', weight: 0.0 },
                                               { name: 'Low', abbreviation: 'L', weight: 0.25 },
                                               { name: 'Medium', abbreviation: 'M', weight: 0.75 },
                                               { name: 'High', abbreviation: 'H', weight: 1.0 },
                                               { name: 'Not Defined', abbreviation: 'ND', weight: 1.0 }]))
  @properties.push(@security_requirements_cr =
                     CvssProperty.new(name: 'Confidentiality Requirement', abbreviation: 'CR', position: [8, 11],
                                      values: [{ name: 'Low', abbreviation: 'L', weight: 0.5 },
                                               { name: 'Medium', abbreviation: 'M', weight: 1.0 },
                                               { name: 'High', abbreviation: 'H', weight: 1.51 },
                                               { name: 'Not Defined', abbreviation: 'ND', weight: 1.0 }]))
  @properties.push(@security_requirements_ir =
                     CvssProperty.new(name: 'Integrity Requirement', abbreviation: 'IR', position: [9, 12],
                                      values: [{ name: 'Low', abbreviation: 'L', weight: 0.5 },
                                               { name: 'Medium', abbreviation: 'M', weight: 1.0 },
                                               { name: 'High', abbreviation: 'H', weight: 1.51 },
                                               { name: 'Not Defined', abbreviation: 'ND', weight: 1.0 }]))
  @properties.push(@security_requirements_ar =
                     CvssProperty.new(name: 'Availability Requirement', abbreviation: 'AR', position: [10, 13],
                                      values: [{ name: 'Low', abbreviation: 'L', weight: 0.5 },
                                               { name: 'Medium', abbreviation: 'M', weight: 1.0 },
                                               { name: 'High', abbreviation: 'H', weight: 1.51 },
                                               { name: 'Not Defined', abbreviation: 'ND', weight: 1.0 }]))
end