You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
599B

  1. require 'erb'
  2. require 'parallel'
  3. module CryptCheck
  4. module Tls
  5. def self.analyze(host, port)
  6. ::CryptCheck.analyze host, port, TcpServer, Grade
  7. end
  8. def self.colorize(cipher)
  9. colors = case
  10. when /^SSL/ =~ cipher then :critical
  11. when :TLSv1_2 == cipher then :good
  12. end
  13. cipher.to_s.colorize colors
  14. end
  15. def self.key_to_s(key)
  16. type_color = case key.type
  17. when :ecc then :good
  18. when :dh then :warning
  19. when :dsa then :critical
  20. end
  21. "#{key.type.to_s.upcase.colorize type_color} #{key.size.to_s.colorize key.status} bits"
  22. end
  23. end
  24. end