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.

smtp.rb 611B

12345678910111213141516171819
  1. module CryptCheck
  2. module Tls
  3. module Smtp
  4. def self.analyze(host, port=25, domain: nil)
  5. ::CryptCheck.analyze host, port, Server, Grade, domain: domain
  6. end
  7. def self.analyze_domain(domain)
  8. srv = Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::MX).sort_by &:preference
  9. hosts = srv.empty? ? [domain] : srv.collect { |s| s.exchange.to_s }
  10. hosts.collect { |h| self.analyze h, domain: domain }.flatten(1)
  11. end
  12. def self.analyze_file(input, output)
  13. ::CryptCheck.analyze_file(input, 'output/smtp.erb', output) { |host| self.analyze_domain host }
  14. end
  15. end
  16. end
  17. end