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.

tls.rb 541B

123456789101112131415161718192021222324
  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.key_to_s(key)
  9. size, color = case key.type
  10. when :ecc
  11. ["#{key.group.curve_name} #{key.size}", :good]
  12. when :rsa
  13. [key.size, nil]
  14. when :dsa
  15. [key.size, :critical]
  16. when :dh
  17. [key.size, :warning]
  18. end
  19. "#{key.type.to_s.upcase.colorize color} #{size.to_s.colorize key.status} bits"
  20. end
  21. end
  22. end