class SSLyze::XML::Target
Represents the `<target>` XML
element.
Public Class Methods
Initializes the target.
@param [Nokogiri::XML::Node] node
The `<target>` XML element.
# File lib/sslyze/xml/target.rb, line 30 def initialize(node) @node = node end
Public Instance Methods
Compares the other target to this target.
@param [Target] other
The other target.
@return [Boolean]
Whether the other target has the same {#host} and {#port}.
# File lib/sslyze/xml/target.rb, line 365 def ==(other) other.kind_of?(self.class) && other.host == host && other.port == port end
Certificate information.
@return [Certinfo, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 90 def certinfo @cert_info ||= if (element = @node.at_xpath('certinfo')) Certinfo.new(element) end end
Which compression algorithms are supported.
@return [Compression, nil]
# File lib/sslyze/xml/target.rb, line 77 def compression @compression ||= if (element = @node.at_xpath('compression')) Compression.new(element) end end
Iterates over every SSL/TLS protocol.
@yield [protocol]
The given block will be passed each SSL/TLS protocol.
@yieldparam [Protocol] protocol
A SSL/TLS protocol.
@return [Enumerator]
If a no block was given, an Enumerator will be returned.
@see sslv2
@see sslv3
@see tlsv1
@see tlsv1_1
@see tlsv1_2
# File lib/sslyze/xml/target.rb, line 308 def each_protocol(&block) return enum_for(__method__) unless block each_ssl_protocol(&block) each_tls_protocol(&block) end
Iterates over every SSL protocol.
@yield [protocol]
The given block will be passed each SSL protocol.
@yieldparam [Protocol] protocol
A SSL protocol.
@return [Enumerator]
If a no block was given, an Enumerator will be returned.
# File lib/sslyze/xml/target.rb, line 241 def each_ssl_protocol return enum_for(__method__) unless block_given? yield sslv2 if sslv2 yield sslv3 if sslv3 end
Iterates over every TLS protocol.
@yield [protocol]
The given block will be passed each TLS protocol.
@yieldparam [Protocol] protocol
A TLS protocol.
@return [Enumerator]
If a no block was given, an Enumerator will be returned.
@see tlsv1
@see tlsv1_1
@see tlsv1_2
# File lib/sslyze/xml/target.rb, line 273 def each_tls_protocol return enum_for(__method__) unless block_given? yield tlsv1 if tlsv1 yield tlsv1_1 if tlsv1_1 yield tlsv1_2 if tlsv1_2 end
@return [Fallback, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 329 def fallback @fallback ||= if (element = @node.at_xpath('fallback')) Fallback.new(element) end end
@return [Heartbleed, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 103 def heartbleed @heartbleed ||= if (element = @node.at_xpath('heartbleed')) Heartbleed.new(element) end end
The host name of the target.
@return [String]
# File lib/sslyze/xml/target.rb, line 39 def host @host ||= @node['host'] end
@return [HTTPHeaders, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 114 def http_headers @http_headers ||= if (element = @node.at_xpath('http_headers')) HTTPHeaders.new(element) end end
The IP address of the target.
@return [String]
# File lib/sslyze/xml/target.rb, line 48 def ip @ip ||= @node['ip'] end
The IP address of the target.
@return [IPAddr]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 59 def ipaddr IPAddr.new(ip) end
@return [OpenSSLCCS, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 340 def openssl_ccs @openssl_ccs ||= if (element = @node.at_xpath('openssl_ccs')) OpenSSLCCS.new(element) end end
The port number that was scanned.
@return [Integer]
# File lib/sslyze/xml/target.rb, line 68 def port @port ||= @node['port'].to_i end
All supported SSL/TLS protocols.
@return [Array<Protocol>]
# File lib/sslyze/xml/target.rb, line 320 def protocols each_protocol.to_a end
Specifies whether the service supports Session Renegotiation.
@return [Reneg, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 127 def reneg @reneg ||= if (element = @node.at_xpath('reneg')) Reneg.new(element) end end
@return [Resum, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 140 def resum @resum ||= if (element = @node.at_xpath('resum')) Resum.new(element) end end
@return [Resum, nil]
@since 1.0.0
# File lib/sslyze/xml/target.rb, line 153 def resum_rate @resum ||= if (element = @node.at_xpath('resum_rate')) ResumRate.new(element) end end
All supported SSL protocols.
@return [Array<Protocol>]
# File lib/sslyze/xml/target.rb, line 253 def ssl_protocols each_ssl_protocol.to_a end
SSLv2 protocol information.
@return [Protocol, nil]
# File lib/sslyze/xml/target.rb, line 166 def sslv2 @sslv2 ||= if (element = @node.at_xpath('sslv2')) Protocol.new(element) end end
SSLv3 protocol information.
@return [Protocol, nil]
# File lib/sslyze/xml/target.rb, line 179 def sslv3 @sslv3 ||= if (element = @node.at_xpath('sslv3')) Protocol.new(element) end end
All supported TLS protocols.
@return [Array<Protocol>]
# File lib/sslyze/xml/target.rb, line 286 def tls_protocols each_tls_protocol.to_a end
TLSv1 protocol information.
@return [Protocol, nil]
# File lib/sslyze/xml/target.rb, line 192 def tlsv1 @tlsv1 ||= if (element = @node.at_xpath('tlsv1')) Protocol.new(element) end end
TLSv1.1 protocol information.
@return [Protocol, nil]
# File lib/sslyze/xml/target.rb, line 205 def tlsv1_1 @tlsv1_1 ||= if (element = @node.at_xpath('tlsv1_1')) Protocol.new(element) end end
TLSv1.2 protocol information.
@return [Protocol, nil]
# File lib/sslyze/xml/target.rb, line 218 def tlsv1_2 @tlsv1_2 ||= if (element = @node.at_xpath('tlsv1_2')) Protocol.new(element) end end
Convert the target to a String.
@return [String]
The host and port.
# File lib/sslyze/xml/target.rb, line 352 def to_s "#{host}:#{port}" end