Browse Source

Remove score

master
aeris 2 years ago
parent
commit
2d014181b4
1 changed files with 2 additions and 37 deletions
  1. 2
    37
      lib/cryptcheck/tls/grade.rb

+ 2
- 37
lib/cryptcheck/tls/grade.rb View File

@@ -1,14 +1,10 @@
1 1
 module CryptCheck
2 2
 	module Tls
3 3
 		class Grade
4
-			attr_reader :server, :protocol_score, :key_exchange_score, :cipher_strengths_score, :score, :grade, :error, :danger, :warning, :success
4
+			attr_reader :server, :score, :grade, :error, :danger, :warning, :success
5 5
 
6 6
 			def initialize(server)
7 7
 				@server = server
8
-				calculate_protocol_score
9
-				calculate_key_exchange_score
10
-				calculate_cipher_strengths_score
11
-				@score = @protocol_score*0.3 + @key_exchange_score*0.3 + @cipher_strengths_score*0.4
12 8
 				calculate_states
13 9
 				calculate_grade
14 10
 			end
@@ -24,11 +20,6 @@ module CryptCheck
24 20
 
25 21
 				Logger.info { "Grade : #{self.grade.colorize color }" }
26 22
 				Logger.info { '' }
27
-				Logger.info { "Protocole : #{self.protocol_score} / 100" }
28
-				Logger.info { "Key exchange : #{self.key_exchange_score} / 100" }
29
-				Logger.info { "Ciphers strength : #{self.cipher_strengths_score} / 100" }
30
-				Logger.info { "Overall score : #{self.score} / 100" }
31
-				Logger.info { '' }
32 23
 				Logger.info { "Errors : #{self.error.join(' ').colorize :red }" } unless self.error.empty?
33 24
 				Logger.info { "Warnings : #{self.warning.join(' ').colorize :yellow }" } unless self.warning.empty?
34 25
 				Logger.info { "Best practices : #{self.success.join(' ').colorize :green }" } unless self.success.empty?
@@ -45,7 +36,7 @@ module CryptCheck
45 36
 							 else 'A'
46 37
 						 end
47 38
 
48
-				@grade = [@grade, 'B'].max if !@server.tlsv1_2? or @server.key_size < 2048
39
+				@grade = [@grade, 'B'].max if !@server.tlsv1_2? or %i(error warning).include? @server.key.status
49 40
 				@grade = [@grade, 'F'].max unless @error.empty?
50 41
 				@grade = [@grade, 'F'].max unless @error.empty?
51 42
 
@@ -85,32 +76,6 @@ module CryptCheck
85 76
 			def all_success
86 77
 				ALL_SUCCESS
87 78
 			end
88
-
89
-			METHODS_SCORES = { SSLv2: 0, SSLv3: 20, TLSv1: 60, TLSv1_1: 80, TLSv1_2: 100 }
90
-			def calculate_protocol_score
91
-				@protocol_score = @server.supported_protocols.collect { |p| METHODS_SCORES[p] }.min
92
-			end
93
-
94
-			def calculate_key_exchange_score
95
-				@key_exchange_score = case @server.key_size
96
-										  when 0 then 0
97
-										  when 0...512 then 10
98
-										  when 512...1024 then 20
99
-										  when 1024...3072 then 50
100
-										  when 3072...4096 then 90
101
-										  else 100
102
-									  end
103
-			end
104
-
105
-			def calculate_cipher_strengths_score
106
-				@cipher_strengths_score = case @server.cipher_size
107
-					when 0 then 0
108
-					when 0...112 then 10
109
-					when 112...128 then 50
110
-					when 128...256 then 90
111
-					else 100
112
-				end
113
-			end
114 79
 		end
115 80
 	end
116 81
 end

Loading…
Cancel
Save