rex-socket 0.1.30 → 0.1.34

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: 647d60dcc0fb176246243a7eaed1ca68a35c596c7034cf4de863ca233d08d9f0
4
- data.tar.gz: 80fcd4c8fe671a6da97a5e262700331dfa5fe0292c679952b510abdc7af13cfa
3
+ metadata.gz: b7c47df3f39b889182acdf10979bdf50d435d605e79d9242549ed300de2298b9
4
+ data.tar.gz: 23844c82242b552bdea184aa95b5c499766ab70e9f77cc9baaa73b7edea81cab
5
5
  SHA512:
6
- metadata.gz: a5c001e83da2f988ff40eefcd5175bdf0684b22c5529820be68c9eda4b6d862a6f88bbd39a950941a30bcccc5b9a21479a44982e56a4e351b353c0ce480bc9a9
7
- data.tar.gz: bdc211d907a45d1a0701fbc34721712fec81dea7e9417d1b3e94259916e13779a1e91e1742fd2b9526aaf4c8839c62373e58183c3ac7ad7dea64c3b8fd5d093d
6
+ metadata.gz: 91887057ffde34e4fd7a30b4148e4da3f3442d5e99f746e2d464515bf81ad7a459932a8c69879d83267dc06939abadad17c50fad21b42e026047f879a8869cc4
7
+ data.tar.gz: aed583e93601c0ac04343844aad9b4304f5a848fb9c44405ddc8bc33cdeabbc2e8470a8f4c78fded2933a154e3aaf9b53f2c652e46471180349fd83c7d3b861c
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,4 @@
1
- a)\�1}����������m8��R�ECFˤ�\+i捤
2
- ���͸xl����|.�݋[�k5���G�[ Goe��OO_C }������r:���*�m�C��#��;��lMJ������"�IZ0S7��<ɓ �����_������]k�J�itm�:���+9O�y#X�� {n���
3
- ���Q Seb�0�j��dO�,g���@���wj�
1
+ H���!��Ò����]}萌d�:}x
2
+ 5"�4��5(.����S��GuM –-4����0�����2�]��3w��?dF�Ԯ
3
+ {�ߟG;��#��
4
+ ��|�-�:�� �*+��s��K�[D��:u^l�H�����m#��y�ERNDנ��W��MRE�eU��\��\�?�i]8��
@@ -10,7 +10,7 @@ on:
10
10
 
11
11
  jobs:
12
12
  test:
13
- runs-on: ubuntu-16.04
13
+ runs-on: ubuntu-18.04
14
14
  timeout-minutes: 40
15
15
 
16
16
  strategy:
@@ -32,23 +32,12 @@ jobs:
32
32
  - name: Checkout code
33
33
  uses: actions/checkout@v2
34
34
 
35
- - uses: actions/setup-ruby@v1
35
+ - name: Setup Ruby
36
+ uses: ruby/setup-ruby@v1
36
37
  with:
37
38
  ruby-version: ${{ matrix.ruby }}
39
+ bundler-cache: true
38
40
 
39
- - name: Setup bundler
40
- run: |
41
- gem install bundler
42
- - uses: actions/cache@v2
43
- with:
44
- path: vendor/bundle
45
- key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
46
- restore-keys: |
47
- ${{ runner.os }}-gems-
48
- - name: Bundle install
49
- run: |
50
- bundle config path vendor/bundle
51
- bundle install --jobs 4 --retry 3
52
41
  - name: ${{ matrix.test_cmd }}
53
42
  run: |
54
43
  echo "${CMD}"
@@ -192,7 +192,15 @@ class Rex::Socket::Parameters
192
192
  end
193
193
 
194
194
  # Whether to force IPv6 addressing
195
- self.v6 = hash['IPv6']
195
+ if hash['IPv6'].nil?
196
+ # if IPv6 isn't specified and at least one host is an IPv6 address and the
197
+ # other is either nil, a hostname or an IPv6 address, then use IPv6
198
+ self.v6 = (Rex::Socket.is_ipv6?(self.localhost) || Rex::Socket.is_ipv6?(self.peerhost)) && \
199
+ (self.localhost.nil? || !Rex::Socket.is_ipv4?(self.localhost)) && \
200
+ (self.peerhost.nil? || !Rex::Socket.is_ipv4?(self.peerhost))
201
+ else
202
+ self.v6 = hash['IPv6']
203
+ end
196
204
  end
197
205
 
198
206
  def merge(other)
@@ -294,7 +302,13 @@ class Rex::Socket::Parameters
294
302
  # @return [String]
295
303
  attr_writer :localhost
296
304
  def localhost
297
- @localhost || '0.0.0.0'
305
+ return @localhost if @localhost
306
+
307
+ if @v6 || (@peerhost && Rex::Socket.is_ipv6?(@peerhost))
308
+ '::'
309
+ else
310
+ '0.0.0.0'
311
+ end
298
312
  end
299
313
 
300
314
  # The local port. Equivalent to the LocalPort parameter hash key.
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.30"
3
+ VERSION = "0.1.34"
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
@@ -730,7 +732,7 @@ module Socket
730
732
  # Wrapper around getsockname that stores the local address and local port values.
731
733
  #
732
734
  def getlocalname
733
- if self.localhost.nil? && self.localport.nil?
735
+ if [nil, '0.0.0.0', '::'].include?(self.localhost) && [nil, 0].include?(self.localport)
734
736
  _, self.localhost, self.localport = getsockname
735
737
  end
736
738
 
@@ -821,4 +823,3 @@ end
821
823
  SHUT_RDWR = ::Socket::SHUT_RDWR
822
824
  SHUT_RD = ::Socket::SHUT_RD
823
825
  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.30
4
+ version: 0.1.34
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-08-05 00:00:00.000000000 Z
96
+ date: 2021-10-28 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- �D~�[8Yo�:�a�㎊� �<�|�iq����tpI>��|@W��:�y'�x����/��1���(�%M��B��P\0?���f����O��K�W+�O�l,�y ����AdR�/��U��xe_�3ʊqX�,Z���O��80)�����i�Rp;��+a/F��d�Y��']N��%)���r\�1=YJK�_�H�i6~����2�i4�**�ͭ�XY.�")5eފ"k�Wŋ����k s
1
+ |o����&� 2��a�fcѨ��֎|�R�O��| )�& >-'s/����Agu9ck�� �����X ����1�Yΐ�~7���P?��-�_s�?P�:�� ԛ�e1s��jl�:��\�J�