Browse Source

Fix grade color

new-scoring
aeris 2 years ago
parent
commit
b6055e7d90
2 changed files with 20 additions and 3 deletions
  1. 17
    0
      lib/cryptcheck/tls/grade.rb
  2. 3
    3
      lib/cryptcheck/tls/host.rb

+ 17
- 0
lib/cryptcheck/tls/grade.rb View File

@@ -5,6 +5,23 @@ module CryptCheck
@grade ||= calculate_grade
end

GRADE_STATUS = {
V: :critical,
T: :critical,

G: :critical,
F: :error,
E: :warning,
D: nil,
C: :good,
B: :great,
A: :best,
:'A+' => :best
}
def grade_status
GRADE_STATUS.fetch self.grade, :unknown
end

private
def calculate_grade
return :V unless self.valid?

+ 3
- 3
lib/cryptcheck/tls/host.rb View File

@@ -37,7 +37,7 @@ module CryptCheck
server(*args)
end
Logger.info ''
Logger.info { "Grade : #{server.grade.to_s.colorize server.status}" }
Logger.info { "Grade : #{server.grade.to_s.colorize server.grade_status}" }
server
rescue Engine::TLSException, Engine::ConnectionError, Engine::Timeout => e
AnalysisFailure.new e
@@ -46,8 +46,8 @@ module CryptCheck
end
[[@hostname, ip, @port], result]
end.to_h
# rescue StandardError
# raise
rescue StandardError
raise
rescue => e
@error = e
end

Loading…
Cancel
Save