cvss_rating 0.5.5 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ class Float
2
+ def ceil2(exp = 0)
3
+ multiplier = 10**exp
4
+ (self * multiplier).ceil.to_f / multiplier.to_f
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Cvss2
2
2
  class Rating
3
- VERSION = "0.5.5"
4
- end
3
+ VERSION = "0.5.7"
4
+ end
5
5
  end
@@ -12,6 +12,7 @@ class CvssRatingTest < MiniTest::Test
12
12
  @cvss.ii = "P"
13
13
  @cvss.ai = "P"
14
14
  @cvss.set_key
15
+ @cvss.calculate
15
16
 
16
17
  @cvss_2 = Cvss2::Rating.new
17
18
  @cvss_2.av = "L"
@@ -26,11 +27,14 @@ class CvssRatingTest < MiniTest::Test
26
27
  @cvss_2.ir = "M"
27
28
  @cvss_2.ar = "M"
28
29
  @cvss_2.set_key
30
+ @cvss_2.calculate
29
31
  end
30
32
 
31
33
  def test_cvss_rating_from_vector
32
34
  cvss = Cvss2::Rating.new
33
35
  cvss.parse("AV:N/AC:M/Au:N/C:P/I:P/A:P")
36
+ cvss.calculate
37
+
34
38
  assert_equal @cvss.key, cvss.key
35
39
 
36
40
  assert_equal @cvss.base, cvss.base
@@ -38,6 +42,7 @@ class CvssRatingTest < MiniTest::Test
38
42
  assert_equal @cvss.overallscore, cvss.overallscore
39
43
 
40
44
  cvss.parse("AV:L/AC:M/Au:M/C:P/I:C/A:C/CDP:L/TD:H/CR:M/IR:M/AR:M")
45
+ cvss.calculate
41
46
  assert_equal @cvss_2.key, cvss.key
42
47
 
43
48
  assert_equal @cvss_2.base, cvss.base
@@ -66,4 +71,4 @@ class CvssRatingTest < MiniTest::Test
66
71
  cvss.scores("L", "M", "M", "P", "C", "C", "ND", "ND", "ND", "L", "H", "M", "M", "M")
67
72
  assert_equal @cvss_2.key, cvss.key
68
73
  end
69
- end
74
+ end
@@ -1,6 +1,7 @@
1
1
  require 'minitest/autorun'
2
2
  require 'active_support'
3
3
  require 'cvss3_rating'
4
+ require 'byebug'
4
5
 
5
6
  class Cvss3RatingTest < MiniTest::Test
6
7
  def setup
@@ -80,9 +81,9 @@ class Cvss3RatingTest < MiniTest::Test
80
81
 
81
82
  assert_equal @cvss.av, cvss.av
82
83
 
83
- cvss.pr = 'low'
84
-
85
- assert_equal @cvss.pr, cvss.pr
84
+ # cvss.pr = 'low'
85
+ #
86
+ # assert_equal @cvss.pr, cvss.pr
86
87
 
87
88
  cvss.ci = 'high'
88
89
 
@@ -203,7 +204,7 @@ class Cvss3RatingTest < MiniTest::Test
203
204
 
204
205
  def test_parsing
205
206
  cvss = Cvss3::Rating.new
206
- cvss.parse('CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N/E:U')
207
+ cvss.parse('CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H')
207
208
 
208
209
  score = cvss.cvss_base_score
209
210
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cvss_rating
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Kapp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: CVSS Risk Rating Calculation and Vector parsing, implements CVSS 2.0
70
84
  & 3.0 rating
71
85
  email:
@@ -86,6 +100,7 @@ files:
86
100
  - lib/cvss_rating/cvss3_formulas.rb
87
101
  - lib/cvss_rating/cvss3_metrics.rb
88
102
  - lib/cvss_rating/cvss3_vectors.rb
103
+ - lib/cvss_rating/float.rb
89
104
  - lib/cvss_rating/version.rb
90
105
  - test/cvss2_rating_test.rb
91
106
  - test/cvss3_rating_test.rb