rex-sslscan 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c7fdc7636e22b47614d8de6f29f9577349ffee063bdbea4b67bbe99bce18af4
4
- data.tar.gz: 03bad2316a556f16a8349854585d24d6679a6dfb8028b597219a3809b86044a5
3
+ metadata.gz: cef4452d76a846d5eba655bd26b54eaf4dc395c460159dbc63513cf2132cc849
4
+ data.tar.gz: 22297a7682033968b7289572fa14744b18c93a7adc5a83f107739741587dc05b
5
5
  SHA512:
6
- metadata.gz: fe105a8f01ba50a76ef5a5d3c4308b7fb80c94c34748e28913cb493627ab0cd56df67ba9c9fe48a03dfcf553ff87d7ed6920ea0dfdf2fcc21bae1f867f780dae
7
- data.tar.gz: 9c0e262ffe92df3bb2e4ac667e68889ff26969a0b27df40d4bb8077c255297ca722ccfb1fec1d7759dc97860c514c584396d577ff407d29f20bf7797f30cc24a
6
+ metadata.gz: 02dc4ff4d97bf79b3b7a098c010583933d12ab241c9b84929bec7888c90d75a75dbee9e5038b68fea4dbe8236e99e0d2d825067e76ab71cf4a07564a3c3ea9fc
7
+ data.tar.gz: b4678f9fe1770c3374c8601d3bc5d7128edb347b86f424655fb9c93b498f635f6b16507929685e5b555dddfb042076604962347c37095ec0a027820f9faabc6b
data/README.md CHANGED
@@ -23,6 +23,8 @@ Or install it yourself as:
23
23
  ## Usage
24
24
 
25
25
  ```
26
+ require 'rex-sslscan'
27
+
26
28
  scanner = Rex::SSLScan::Scanner.new('192.168.1.1', 443)
27
29
  results = scanner.scan
28
30
  print_status results.to_s
@@ -16,17 +16,20 @@ class Scanner
16
16
 
17
17
  attr_reader :supported_versions
18
18
  attr_reader :sslv2
19
+ attr_reader :tls_server_name_indication
19
20
 
20
21
  # Initializes the scanner object
21
22
  # @param host [String] IP address or hostname to scan
22
23
  # @param port [Integer] Port number to scan, default: 443
23
24
  # @param timeout [Integer] Timeout for connections, in seconds. default: 5
25
+ # @param tls_server_name_indication [String,nil] TLS Server Name Indication (SNI)
24
26
  # @raise [StandardError] Raised when the configuration is invalid
25
- def initialize(host,port = 443,context = {},timeout=5)
27
+ def initialize(host,port = 443,context = {},timeout=5,tls_server_name_indication: nil)
26
28
  @host = host
27
29
  @port = port
28
30
  @timeout = timeout
29
31
  @context = context
32
+ @tls_server_name_indication = tls_server_name_indication
30
33
  if check_opensslv2 == true
31
34
  @supported_versions = [:SSLv2, :SSLv3, :TLSv1, :TLSv1_1, :TLSv1_2]
32
35
  @sslv2 = true
@@ -55,7 +58,7 @@ class Scanner
55
58
  scan_result.openssl_sslv2 = sslv2
56
59
  # If we can't get any SSL connection, then don't bother testing
57
60
  # individual ciphers.
58
- if test_ssl == :rejected and test_tls == :rejected
61
+ if test_ssl == :rejected and test_tls(versions: supported_tls_versions) == :rejected
59
62
  return scan_result
60
63
  end
61
64
 
@@ -106,24 +109,29 @@ class Scanner
106
109
  return :accepted
107
110
  end
108
111
 
109
- def test_tls
110
- begin
111
- scan_client = Rex::Socket::Tcp.create(
112
- 'Context' => @context,
113
- 'PeerHost' => @host,
114
- 'PeerPort' => @port,
115
- 'SSL' => true,
116
- 'SSLVersion' => :TLSv1,
117
- 'Timeout' => @timeout
118
- )
119
- rescue ::Exception => e
120
- return :rejected
121
- ensure
122
- if scan_client
123
- scan_client.close
112
+ def test_tls(versions: [:TLSv1])
113
+ supported_version = versions.find do |version|
114
+ begin
115
+ scan_client = Rex::Socket::Tcp.create(
116
+ 'Context' => @context,
117
+ 'PeerHost' => @host,
118
+ 'PeerPort' => @port,
119
+ 'PeerHostname' => @tls_server_name_indication,
120
+ 'SSL' => true,
121
+ 'SSLVersion' => version,
122
+ 'Timeout' => @timeout
123
+ )
124
+ version
125
+ rescue ::Exception => e
126
+ nil
127
+ ensure
128
+ if scan_client
129
+ scan_client.close
130
+ end
124
131
  end
125
132
  end
126
- return :accepted
133
+
134
+ supported_version ? :accepted : :rejected
127
135
  end
128
136
 
129
137
  # Tests the specified SSL Version and Cipher against the configured target
@@ -137,6 +145,7 @@ class Scanner
137
145
  'Context' => @context,
138
146
  'PeerHost' => @host,
139
147
  'PeerPort' => @port,
148
+ 'PeerHostname' => @tls_server_name_indication,
140
149
  'SSL' => true,
141
150
  'SSLVersion' => ssl_version,
142
151
  'SSLCipher' => cipher,
@@ -164,6 +173,7 @@ class Scanner
164
173
  scan_client = Rex::Socket::Tcp.create(
165
174
  'PeerHost' => @host,
166
175
  'PeerPort' => @port,
176
+ 'PeerHostname' => @tls_server_name_indication,
167
177
  'SSL' => true,
168
178
  'SSLVersion' => ssl_version,
169
179
  'SSLCipher' => cipher,
@@ -187,6 +197,10 @@ class Scanner
187
197
 
188
198
  protected
189
199
 
200
+ def supported_tls_versions
201
+ @supported_versions.select { |v| v.to_s.start_with?('TLS') }
202
+ end
203
+
190
204
  # Validates that the SSL Version and Cipher are valid both seperately and
191
205
  # together as part of an SSL Context.
192
206
  # @param ssl_version [Symbol] The SSL version to use (:SSLv2, :SSLv3, :TLSv1)
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Sslscan
3
- VERSION = "0.1.12"
3
+ VERSION = "0.1.13"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rex-sslscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-02 00:00:00.000000000 Z
11
+ date: 2025-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake