Class: SSLyze::Target
Overview
Represents the <target>
XML element.
Defined Under Namespace
Classes: SessionRenegotiation
Constant Summary
Constants included from Types
SSLyze::Types::Boolean, SSLyze::Types::None
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares the other target to this target.
-
#cert_info ⇒ CertInfo?
Certificate information.
-
#compression ⇒ Hash{Symbol => Boolean}
Which compression algorithms are supported.
-
#each_protocol {|protocol| ... } ⇒ Enumerator
Iterates over every SSL/TLS protocol.
-
#each_ssl_protocol {|protocol| ... } ⇒ Enumerator
Iterates over every SSL protocol.
-
#each_tls_protocol {|protocol| ... } ⇒ Enumerator
Iterates over every TLS protocol.
-
#heartbleed? ⇒ Boolean?
Specifies whether the service was vulnerable to Heartbleed.
-
#host ⇒ String
The host name of the target.
-
#initialize(node) ⇒ Target
constructor
Initializes the target.
-
#ip ⇒ String
The IP address of the target.
-
#port ⇒ Integer
The port number that was scanned.
-
#protocols ⇒ Array<Protocol>
All supported SSL/TLS protocols.
-
#session_renegotiation ⇒ SessionRenegotiation?
Specifies whether the service supports Session Renegotiation.
-
#ssl_protocols ⇒ Array<Protocol>
All supported SSL protocols.
-
#sslv2 ⇒ Protocol?
(also: #ssl_v2)
SSLv2 protocol information.
-
#sslv3 ⇒ Protocol?
(also: #ssl_v3)
SSLv3 protocol information.
-
#tls_protocols ⇒ Array<Protocol>
All supported TLS protocols.
-
#tlsv1 ⇒ Protocol?
(also: #tls_v1)
TLSv1 protocol information.
-
#tlsv1_1 ⇒ Protocol?
(also: #tls_v1_1)
TLSv1.1 protocol information.
-
#tlsv1_2 ⇒ Protocol?
(also: #tls_v1_2)
TLSv1.2 protocol information.
-
#to_s ⇒ String
Convert the target to a String.
Constructor Details
#initialize(node) ⇒ Target
Initializes the target.
19 20 21 |
# File 'lib/sslyze/target.rb', line 19 def initialize(node) @node = node end |
Instance Method Details
#==(other) ⇒ Boolean
Compares the other target to this target.
300 301 302 |
# File 'lib/sslyze/target.rb', line 300 def ==(other) other.kind_of?(self.class) && other.host == host && other.port == port end |
#cert_info ⇒ CertInfo?
Certificate information.
55 56 57 58 59 |
# File 'lib/sslyze/target.rb', line 55 def cert_info @cert_info ||= if (certinfo = @node.at('certinfo')) CertInfo.new(certinfo) end end |
#compression ⇒ Hash{Symbol => Boolean}
Which compression algorithms are supported.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/sslyze/target.rb', line 67 def compression unless @compression @compression = {} @node.search('compression/compressionMethod').map do |compression| type = compression['type'].downcase.to_sym supported = Boolean[compression['isSupported']] @compression[type] = supported end end return @compression end |
#each_protocol {|protocol| ... } ⇒ Enumerator
Iterates over every SSL/TLS protocol.
265 266 267 268 269 270 |
# File 'lib/sslyze/target.rb', line 265 def each_protocol(&block) return enum_for(__method__) unless block each_ssl_protocol(&block) each_tls_protocol(&block) end |
#each_ssl_protocol {|protocol| ... } ⇒ Enumerator
Iterates over every SSL protocol.
204 205 206 207 208 209 |
# File 'lib/sslyze/target.rb', line 204 def each_ssl_protocol return enum_for(__method__) unless block_given? yield sslv2 if sslv2 yield sslv3 if sslv3 end |
#each_tls_protocol {|protocol| ... } ⇒ Enumerator
Iterates over every TLS protocol.
234 235 236 237 238 239 240 |
# File 'lib/sslyze/target.rb', line 234 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 |
#heartbleed? ⇒ Boolean?
Specifies whether the service was vulnerable to Heartbleed.
87 88 89 90 91 |
# File 'lib/sslyze/target.rb', line 87 def heartbleed? if (heartbleed = @node.at('heartbleed/openSslHeartbleed')) Boolean[heartbleed['isVulnerable']] end end |
#host ⇒ String
The host name of the target.
28 29 30 |
# File 'lib/sslyze/target.rb', line 28 def host @host ||= @node['host'] end |
#ip ⇒ String
The IP address of the target.
37 38 39 |
# File 'lib/sslyze/target.rb', line 37 def ip @ip ||= @node['ip'] end |
#port ⇒ Integer
The port number that was scanned.
46 47 48 |
# File 'lib/sslyze/target.rb', line 46 def port @port ||= @node['port'].to_i end |
#protocols ⇒ Array<Protocol>
All supported SSL/TLS protocols.
277 278 279 |
# File 'lib/sslyze/target.rb', line 277 def protocols each_protocol.to_a end |
#session_renegotiation ⇒ SessionRenegotiation?
Specifies whether the service supports Session Renegotiation.
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/sslyze/target.rb', line 113 def session_renegotiation @session_renegotiation ||= ( if (sessionRenegotiation = @node.at('reneg/sessionRenegotiation')) SessionRenegotiation.new( Boolean[sessionRenegotiation['canBeClientInitiated']], Boolean[sessionRenegotiation['isSecure']] ) end ) end |
#ssl_protocols ⇒ Array<Protocol>
All supported SSL protocols.
216 217 218 |
# File 'lib/sslyze/target.rb', line 216 def ssl_protocols each_ssl_protocol.to_a end |
#sslv2 ⇒ Protocol? Also known as: ssl_v2
SSLv2 protocol information.
130 131 132 133 134 |
# File 'lib/sslyze/target.rb', line 130 def sslv2 @sslv2 ||= if (node = @node.at('sslv2')) Protocol.new(node) end end |
#sslv3 ⇒ Protocol? Also known as: ssl_v3
SSLv3 protocol information.
143 144 145 146 147 |
# File 'lib/sslyze/target.rb', line 143 def sslv3 @sslv3 ||= if (node = @node.at('sslv3')) Protocol.new(node) end end |
#tls_protocols ⇒ Array<Protocol>
All supported TLS protocols.
247 248 249 |
# File 'lib/sslyze/target.rb', line 247 def tls_protocols each_tls_protocol.to_a end |
#tlsv1 ⇒ Protocol? Also known as: tls_v1
TLSv1 protocol information.
156 157 158 159 160 |
# File 'lib/sslyze/target.rb', line 156 def tlsv1 @tlsv1 ||= if (node = @node.at('tlsv1')) Protocol.new(node) end end |
#tlsv1_1 ⇒ Protocol? Also known as: tls_v1_1
TLSv1.1 protocol information.
169 170 171 172 173 |
# File 'lib/sslyze/target.rb', line 169 def tlsv1_1 @tlsv1_1 ||= if (node = @node.at('tlsv1_1')) Protocol.new(node) end end |
#tlsv1_2 ⇒ Protocol? Also known as: tls_v1_2
TLSv1.2 protocol information.
182 183 184 185 186 |
# File 'lib/sslyze/target.rb', line 182 def tlsv1_2 @tlsv1_2 ||= if (node = @node.at('tlsv1_2')) Protocol.new(node) end end |
#to_s ⇒ String
Convert the target to a String.
287 288 289 |
# File 'lib/sslyze/target.rb', line 287 def to_s "#{host}:#{port}" end |