Class: CvssSuite::Cvss3

Inherits:
Cvss31AndBefore show all
Defined in:
lib/cvss_suite/cvss3/cvss3.rb

Overview

This class represents a CVSS vector in version 3.0.

Instance Attribute Summary

Attributes inherited from Cvss31AndBefore

#environmental, #temporal

Attributes inherited from Cvss

#base

Instance Method Summary collapse

Methods inherited from Cvss31AndBefore

#initialize, #overall_score, #valid?

Methods inherited from Cvss

#initialize, #severity

Constructor Details

This class inherits a constructor from CvssSuite::Cvss31AndBefore

Instance Method Details

#base_scoreObject

Returns the Base Score of the CVSS vector.



25
26
27
28
# File 'lib/cvss_suite/cvss3/cvss3.rb', line 25

def base_score
  check_validity
  Cvss3Helper.round_up(@base.score)
end

#environmental_scoreObject

Returns the Environmental Score of the CVSS vector.



39
40
41
42
43
44
# File 'lib/cvss_suite/cvss3/cvss3.rb', line 39

def environmental_score
  check_validity
  return temporal_score unless @environmental.valid?

  Cvss3Helper.round_up(@environmental.score(@base, @temporal))
end

#temporal_scoreObject

Returns the Temporal Score of the CVSS vector.



32
33
34
35
# File 'lib/cvss_suite/cvss3/cvss3.rb', line 32

def temporal_score
  check_validity
  Cvss3Helper.round_up(Cvss3Helper.round_up(@base.score) * @temporal.score)
end

#vectorObject

Returns the vector itself.



48
49
50
# File 'lib/cvss_suite/cvss3/cvss3.rb', line 48

def vector
  "#{CvssSuite::CVSS_VECTOR_BEGINNINGS.find { |beginning| beginning[:version] == version }[:string]}#{@vector}"
end

#versionObject

Returns the Version of the CVSS vector.



19
20
21
# File 'lib/cvss_suite/cvss3/cvss3.rb', line 19

def version
  3.0
end