rex-socket 0.1.33 → 0.1.36

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a97221671cad2ce1a9169e9b469a6e4d997f081ee3624a6a849c538310c3da0
4
- data.tar.gz: 688b6872080a0ba1db00590ec33866863864a61e265cefcc2e41d416039cf9c7
3
+ metadata.gz: 5c8406c7c6de56b14dfb52d691b52e04bfa41c3c4d3dfec6604864e104371e13
4
+ data.tar.gz: 5b5346a4646a8d1c69a616df64120d5f099c0506f97a3dca5c27b40b4c253d9a
5
5
  SHA512:
6
- metadata.gz: badf3199ee38910229eccb31a6f03deebfed5eb91774fcf25e96ef8d4ab137a7d4fd09cdfbc1ceaec4c7efc96b3900e97a74142f72f8c1828fa965e50b13f45f
7
- data.tar.gz: 2c600b3c7ea3cc45549512d7525a5f17e164a5c11daf18ab006060927bda060a019c13c0a0ca76b2b571494e63eecef75181734b3995e504a4d8a82cc942b90b
6
+ metadata.gz: 1285905a72192b26a171872a76fd2272c51a3d93a78aed5648ad857c356b43bd2d2c7fa7e75ebf742c38a207fc65a7d1e6fb4641c9f5af19af4b53f8151e233f
7
+ data.tar.gz: 73bd96efa3758be73faafa8543343b959e17f4d16f49206be05dc5e65fd44be834756aa6166b2e651b4feababfb6aaa4708f7b40dc2fe39aa70873663d60e12a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -17,10 +17,10 @@ jobs:
17
17
  fail-fast: true
18
18
  matrix:
19
19
  ruby:
20
- - 2.5
21
20
  - 2.6
22
21
  - 2.7
23
22
  - 3.0
23
+ - 3.1
24
24
  test_cmd:
25
25
  - bundle exec rspec
26
26
 
@@ -49,6 +49,7 @@ class Rex::Socket::Parameters
49
49
  # keys can be specified.
50
50
  #
51
51
  # @option hash [String] 'PeerHost' The remote host to connect to
52
+ # @option hash [String] 'PeerHostname' The unresolved remote hostname, used to specify Server Name Indication (SNI)
52
53
  # @option hash [String] 'PeerAddr' (alias for 'PeerHost')
53
54
  # @option hash [Fixnum] 'PeerPort' The remote port to connect to
54
55
  # @option hash [String] 'LocalHost' The local host to communicate from, if any
@@ -84,6 +85,10 @@ class Rex::Socket::Parameters
84
85
  self.peerhost = hash['PeerAddr']
85
86
  end
86
87
 
88
+ if (hash['PeerHostname'])
89
+ self.peerhostname = hash['PeerHostname']
90
+ end
91
+
87
92
  if (hash['LocalHost'])
88
93
  self.localhost = hash['LocalHost']
89
94
  elsif (hash['LocalAddr'])
@@ -291,6 +296,11 @@ class Rex::Socket::Parameters
291
296
  # @return [String]
292
297
  attr_accessor :peerhost
293
298
 
299
+ # The remote hostname information, equivalent to the PeerHostname parameter hash
300
+ # key.
301
+ # @return [String]
302
+ attr_accessor :peerhostname
303
+
294
304
  # The remote port. Equivalent to the PeerPort parameter hash key.
295
305
  # @return [Fixnum]
296
306
  attr_writer :peerport
@@ -123,10 +123,14 @@ begin
123
123
  # Tie the context to a socket
124
124
  self.sslsock = OpenSSL::SSL::SSLSocket.new(self, self.sslctx)
125
125
 
126
- # If peerhost looks like a hostname, set the undocumented 'hostname'
126
+ # If peerhostname is set, or if hostname looks like a hostname, set the undocumented 'hostname'
127
127
  # attribute on sslsock, which enables the Server Name Indication (SNI)
128
128
  # extension
129
- self.sslsock.hostname = self.peerhost if !Rex::Socket.dotted_ip?(self.peerhost)
129
+ if self.peerhostname
130
+ self.sslsock.hostname = self.peerhostname
131
+ else !Rex::Socket.dotted_ip?(self.peerhost)
132
+ self.sslsock.hostname = self.peerhost
133
+ end
130
134
 
131
135
  # Force a negotiation timeout
132
136
  begin
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.33"
3
+ VERSION = "0.1.36"
4
4
  end
5
5
  end
data/lib/rex/socket.rb CHANGED
@@ -184,6 +184,8 @@ module Socket
184
184
  # @param hostname [String] A hostname or ASCII IP address
185
185
  # @return [Array<String>]
186
186
  def self.getaddresses(hostname, accept_ipv6 = true)
187
+ raise ::SocketError, 'getaddrinfo: nodename nor servname provided, or not known' if hostname.nil?
188
+
187
189
  if hostname =~ MATCH_IPV4 || (accept_ipv6 && hostname =~ MATCH_IPV6)
188
190
  return [hostname]
189
191
  end
@@ -704,6 +706,7 @@ module Socket
704
706
  def initsock(params = nil)
705
707
  if (params)
706
708
  self.peerhost = params.peerhost
709
+ self.peerhostname = params.peerhostname
707
710
  self.peerport = params.peerport
708
711
  self.localhost = params.localhost
709
712
  self.localport = params.localport
@@ -783,6 +786,10 @@ module Socket
783
786
  #
784
787
  attr_reader :peerhost
785
788
  #
789
+ # The peer hostname of the connected socket.
790
+ #
791
+ attr_reader :peerhostname
792
+ #
786
793
  # The peer port of the connected socket.
787
794
  #
788
795
  attr_reader :peerport
@@ -807,7 +814,7 @@ module Socket
807
814
 
808
815
  protected
809
816
 
810
- attr_writer :peerhost, :peerport, :localhost, :localport # :nodoc:
817
+ attr_writer :peerhost, :peerhostname, :peerport, :localhost, :localport # :nodoc:
811
818
  attr_writer :context # :nodoc:
812
819
  attr_writer :ipv # :nodoc:
813
820
 
@@ -821,4 +828,3 @@ end
821
828
  SHUT_RDWR = ::Socket::SHUT_RDWR
822
829
  SHUT_RD = ::Socket::SHUT_RD
823
830
  SHUT_WR = ::Socket::SHUT_WR
824
-
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rex-socket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.33
4
+ version: 0.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2021-09-16 00:00:00.000000000 Z
96
+ date: 2022-05-03 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
metadata.gz.sig CHANGED
Binary file