class CvssSuite::Cvss2

This class represents a CVSS vector in version 2.

Public Instance Methods

base_score() click to toggle source

Returns the Base Score of the CVSS vector.

# File lib/cvss_suite/cvss2/cvss2.rb, line 47
def base_score
  check_validity
  @base.score.round(1)
end
environmental_score() click to toggle source

Returns the Environmental Score of the CVSS vector.

# File lib/cvss_suite/cvss2/cvss2.rb, line 60
def environmental_score
  return temporal_score unless @environmental.valid?

  (@environmental.score @base, @temporal.score).round(1)
end
severity() click to toggle source

Returns the severity of the CVSSv2 vector. nvd.nist.gov/vuln-metrics/cvss

# File lib/cvss_suite/cvss2/cvss2.rb, line 28
def severity
  check_validity

  score = overall_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() click to toggle source

Returns the Temporal Score of the CVSS vector.

# File lib/cvss_suite/cvss2/cvss2.rb, line 54
def temporal_score
  (base_score * @temporal.score).round(1)
end
version() click to toggle source

Returns the Version of the CVSS vector.

# File lib/cvss_suite/cvss2/cvss2.rb, line 22
def version
  2
end

Private Instance Methods

init_metrics() click to toggle source
# File lib/cvss_suite/cvss2/cvss2.rb, line 68
def init_metrics
  @base = Cvss2Base.new(@properties)
  @temporal = Cvss2Temporal.new(@properties)
  @environmental = Cvss2Environmental.new(@properties)
end