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.

method.rb 528B

123456789101112131415161718192021222324252627282930
  1. module CryptCheck
  2. module Tls
  3. class Method
  4. extend Enumerable
  5. def self.each(&block)
  6. SUPPORTED.each &block
  7. end
  8. attr_reader :name
  9. def initialize(name)
  10. @name = name
  11. end
  12. EXISTING = %i(TLSv1_2 TLSv1_1 TLSv1 SSLv3 SSLv2)
  13. SUPPORTED = (EXISTING & ::OpenSSL::SSL::SSLContext::METHODS).collect { |m| self.new m }
  14. def to_s
  15. colors = case @name
  16. when *%i(SSLv3 SSLv2)
  17. :critical
  18. when :TLSv1_2
  19. :good
  20. end
  21. @name.to_s.colorize colors
  22. end
  23. end
  24. end
  25. end