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.
25 lines
572 B
25 lines
572 B
require 'erb'
|
|
require 'parallel'
|
|
|
|
module CryptCheck
|
|
module Tls
|
|
def self.aggregate(hosts)
|
|
hosts = [hosts] unless hosts.respond_to? :collect
|
|
hosts.inject([]) { |l, h| l + h.to_h }
|
|
end
|
|
|
|
def self.key_to_s(key)
|
|
size, color = case key.type
|
|
when :ecc
|
|
["#{key.group.curve_name} #{key.size}", :good]
|
|
when :rsa
|
|
[key.size, nil]
|
|
when :dsa
|
|
[key.size, :critical]
|
|
when :dh
|
|
[key.size, :warning]
|
|
end
|
|
"#{key.type.to_s.upcase.colorize color} #{size.to_s.colorize key.status} bits"
|
|
end
|
|
end
|
|
end
|
|
|