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 572B

12345678910111213141516171819202122232425
  1. require 'erb'
  2. require 'parallel'
  3. module CryptCheck
  4. module Tls
  5. def self.aggregate(hosts)
  6. hosts = [hosts] unless hosts.respond_to? :collect
  7. hosts.inject([]) { |l, h| l + h.to_h }
  8. end
  9. def self.key_to_s(key)
  10. size, color = case key.type
  11. when :ecc
  12. ["#{key.group.curve_name} #{key.size}", :good]
  13. when :rsa
  14. [key.size, nil]
  15. when :dsa
  16. [key.size, :critical]
  17. when :dh
  18. [key.size, :warning]
  19. end
  20. "#{key.type.to_s.upcase.colorize color} #{size.to_s.colorize key.status} bits"
  21. end
  22. end
  23. end