rex-socket 0.1.13 → 0.1.14

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
  SHA1:
3
- metadata.gz: e03fb63e7486cc7a61cc293d0dbb37393498c616
4
- data.tar.gz: 683f42beeb59df6ce2b424a206aa26790108d163
3
+ metadata.gz: c071cc13e6d51ecc958ae811200859e60675a57f
4
+ data.tar.gz: 661b1ebf9f43c87f1ef5f7760e484960db8267ec
5
5
  SHA512:
6
- metadata.gz: 1e374551466dfb1faed2dffb38848a951d306e93206611b3d4cbefc2ecc0cfc5d6d2e69d18871679c6b4734809f66ea46c7d7019a99199b7df047359b01a58b7
7
- data.tar.gz: d98c67986b353ccb5078ceb6a572fe2f40616b7c6f614b4d5855fdf09ca2ec89d2d1f7defd51ff9e6b0a3f63f400843048b329121a499f549dbb07dedae9fcf4
6
+ metadata.gz: 7f7ae577e318e988bb740583ba15fbcb2a1944a3b2a19b9a29da7ce188feff89257eda4c382107ad1f790c539e4406bfb6a5f4ae06f6c3cb4d0583581b80eaff
7
+ data.tar.gz: 9ce5bd1040689fdb16605e9ddb214c821ff62e928c4b59eaa1372681f03f02b3a7f8c5b4ff8fa2c235a7a56bc854998995e14dfc2ce329a8204dda2643dfa50b
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -289,10 +289,11 @@ module Socket
289
289
  # nil if it's not convertable.
290
290
  #
291
291
  def self.addr_atoc(mask)
292
+ bits = is_ipv6?(mask) ? 128 : 32
292
293
  mask_i = resolv_nbo_i(mask)
293
294
  cidr = nil
294
- 0.upto(32) do |i|
295
- if ((1 << i)-1) << (32-i) == mask_i
295
+ 0.upto(bits) do |i|
296
+ if ((1 << i)-1) << (bits - i) == mask_i
296
297
  cidr = i
297
298
  break
298
299
  end
@@ -304,9 +305,11 @@ module Socket
304
305
  # Resolves a CIDR bitmask into a dotted-quad. Returns
305
306
  # nil if it's not convertable.
306
307
  #
307
- def self.addr_ctoa(cidr)
308
- return nil unless (0..32) === cidr.to_i
309
- addr_itoa(((1 << cidr)-1) << 32-cidr)
308
+ def self.addr_ctoa(cidr, v6: false)
309
+ bits = v6 ? 128 : 32
310
+ cidr = cidr.to_i
311
+ return nil unless (0..bits) === cidr
312
+ addr_itoa(((1 << cidr)-1) << bits-cidr, v6)
310
313
  end
311
314
 
312
315
  #
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.13"
3
+ VERSION = "0.1.14"
4
4
  end
5
5
  end
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.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Maloney
@@ -88,7 +88,7 @@ cert_chain:
88
88
  G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
89
89
  8mVuTXnyJOKRJA==
90
90
  -----END CERTIFICATE-----
91
- date: 2018-03-26 00:00:00.000000000 Z
91
+ date: 2018-04-03 00:00:00.000000000 Z
92
92
  dependencies:
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: bundler
metadata.gz.sig CHANGED
Binary file