Browse Source

Fix grade color

new-scoring
aeris 5 years ago
parent
commit
b6055e7d90
  1. 17
      lib/cryptcheck/tls/grade.rb
  2. 6
      lib/cryptcheck/tls/host.rb

17
lib/cryptcheck/tls/grade.rb

@ -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?

6
lib/cryptcheck/tls/host.rb

@ -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