Sha256: 4ac5808ec177807426173d01c689b2fc2be714df9953bbfa461de27b0cbf8566

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module SSLScan
  module Commands
    class Host < Command
      attr_accessor :hostname, :options

      def initialize(hostname, options={}, output=nil)
        super([], output)
        @hostname = hostname
        @options  = options
      end

      def execute
        parts = hostname.split(":")
        if parts.length == 2
          scanner = SSLScan::Scanner.new(parts[0], parts[1].to_i)
        else
          scanner = SSLScan::Scanner.new(parts[0])
        end
        # If we can't get any SSL connection, then don't bother testing
        # individual ciphers.
        if [:rejected, :failed].include?(scanner.test_ssl) and [:rejected, :failed].include?(scanner.test_tls)
          errors << "SSL Connection failed"
          return false
        end

        if parts.length == 2
          write_header(parts[0], parts[1])
        else
          write_header(parts[0])
        end

        write_ciphers(scanner)
        write_preferred_ciphers(scanner)
        @results << scanner.results
      end

    end # Host
  end # Commands
end # SSLScan

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ssl_scan-0.0.5 lib/ssl_scan/commands/host.rb
ssl_scan-0.0.4 lib/ssl_scan/commands/host.rb