lib/scanner/ssl.rb in yawast-0.5.0.beta5 vs lib/scanner/ssl.rb in yawast-0.5.0.beta6

- old
+ new

@@ -158,57 +158,9 @@ end puts '' end - def self.check_version_suites(uri, ip, ciphers, version) - puts "\tChecking for #{version} suites (#{ciphers.count} possible suites)" - - #first, let's see if we can connect using this version - so we don't do pointless checks - req = Yawast::Shared::Http.get_http(uri) - req.use_ssl = uri.scheme == 'https' - req.ssl_version = version - begin - req.start do |http| - http.head(uri.path, Yawast::Shared::Http.get_headers) - end - rescue - Yawast::Utilities.puts_info "\t\tVersion: #{version}\tNo Supported Cipher Suites" - return - end - - ciphers.each do |cipher| - #try to connect and see what happens - begin - socket = TCPSocket.new(ip.to_s, uri.port) - context = OpenSSL::SSL::SSLContext.new(version) - context.ciphers = cipher[0] - ssl = OpenSSL::SSL::SSLSocket.new(socket, context) - ssl.hostname = uri.host - - ssl.connect - - check_cipher_strength cipher, ssl - - ssl.sysclose - rescue OpenSSL::SSL::SSLError => e - unless e.message.include?('alert handshake failure') || - e.message.include?('no ciphers available') || - e.message.include?('wrong version number') || - e.message.include?('alert protocol version') || - e.message.include?('Connection reset by peer') - Yawast::Utilities.puts_error "\t\tVersion: #{ssl.ssl_version.ljust(7)}\tBits: #{cipher[2]}\tCipher: #{cipher[0]}\t(Supported But Failed)" - end - rescue => e - unless e.message.include?('Connection reset by peer') - Yawast::Utilities.puts_error "\t\tVersion: #{''.ljust(7)}\tBits: #{cipher[2]}\tCipher: #{cipher[0]}\t(#{e.message})" - end - ensure - ssl.sysclose unless ssl == nil - end - end - end - def self.check_cipher_strength(cipher, ssl) if cipher[2] < 112 || cipher[0].include?('RC4') #less than 112 bits or RC4, flag as a vuln Yawast::Utilities.puts_vuln "\t\tVersion: #{ssl.ssl_version.ljust(7)}\tBits: #{cipher[2]}\tCipher: #{cipher[0]}" elsif cipher[2] >= 128