class SSLyze::XML::Target

Represents the `<target>` XML element.

Public Class Methods

new(node) click to toggle source

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

==(other) click to toggle source

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
cert_info()
Alias for: certinfo
certinfo() click to toggle source

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
Also aliased as: cert_info
compression() click to toggle source

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
each_protocol(&block) click to toggle source

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
each_ssl_protocol() { |sslv2| ... } click to toggle source

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.

@see sslv2 @see sslv3

# 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
each_tls_protocol() { |tlsv1| ... } click to toggle source

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
fallback() click to toggle source

@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
heartbleed() click to toggle source

@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
host() click to toggle source

The host name of the target.

@return [String]

# File lib/sslyze/xml/target.rb, line 39
def host
  @host ||= @node['host']
end
http_headers() click to toggle source

@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
ip() click to toggle source

The IP address of the target.

@return [String]

# File lib/sslyze/xml/target.rb, line 48
def ip
  @ip ||= @node['ip']
end
ipaddr() click to toggle source

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
openssl_ccs() click to toggle source

@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
port() click to toggle source

The port number that was scanned.

@return [Integer]

# File lib/sslyze/xml/target.rb, line 68
def port
  @port ||= @node['port'].to_i
end
protocols() click to toggle source

All supported SSL/TLS protocols.

@return [Array<Protocol>]

# File lib/sslyze/xml/target.rb, line 320
def protocols
  each_protocol.to_a
end
reneg() click to toggle source

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
Also aliased as: session_renegotiation
resum() click to toggle source

@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
Also aliased as: session_resumption
resum_rate() click to toggle source

@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
Also aliased as: session_resumption
session_renegotiation()
Alias for: reneg
session_resumption()
Alias for: resum
ssl_protocols() click to toggle source

All supported SSL protocols.

@return [Array<Protocol>]

# File lib/sslyze/xml/target.rb, line 253
def ssl_protocols
  each_ssl_protocol.to_a
end
ssl_v2()
Alias for: sslv2
ssl_v3()
Alias for: sslv3
sslv2() click to toggle source

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
Also aliased as: ssl_v2
sslv3() click to toggle source

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
Also aliased as: ssl_v3
tls_protocols() click to toggle source

All supported TLS protocols.

@return [Array<Protocol>]

# File lib/sslyze/xml/target.rb, line 286
def tls_protocols
  each_tls_protocol.to_a
end
tls_v1()
Alias for: tlsv1
tls_v1_1()
Alias for: tlsv1_1
tls_v1_2()
Alias for: tlsv1_2
tlsv1() click to toggle source

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
Also aliased as: tls_v1
tlsv1_1() click to toggle source

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
Also aliased as: tls_v1_1
tlsv1_2() click to toggle source

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
Also aliased as: tls_v1_2
to_s() click to toggle source

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