rex-socket 0.1.66 → 0.1.67

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: a71de87f105663943e10753e3a5b6189e28db3d0ee792b92669bda8f064d291d
4
- data.tar.gz: bb9f07894fad3f5cbf111e2869e6213d852bf39f9f1e1cb6db8ffb01822a4041
3
+ metadata.gz: d08e421781956b8e7f7cae6c731fb1589401f375774dbe51fde3dba15170ae3c
4
+ data.tar.gz: 646375e1d851896604d9b4b342bc1158fb0628b42a659fe58622551a66bb097d
5
5
  SHA512:
6
- metadata.gz: 801d1877c1841113ddb0981c5f195bb89c952de7400caef780a80c40df94758a55a142e25a9853fd8a54b94b4c4c8b94bd84481811b81cdae7e0b34bb848c775
7
- data.tar.gz: a29bf5d722df87d7c736601b6cdb5b85586ef8fa8d13d2e8e99328f1c14a8bd2e97f6398d682d4c42321e17cb793763a0050c36635151083eab998cac005a37f
6
+ metadata.gz: 850daee218c584254d1eaf047ad3843b4fcaa648a83add08ae29c71c9142be59613239e6bf46c7c1996b3710bfb02b271320f62ff8d55b3f93c1a2073bd286a2
7
+ data.tar.gz: 3fc4e74930e01ff0a54a22b7f135e83e49693a053b397619b00b2e7ede551cfd4875946c00d46fa537508266c2c79ca68af5d87e0ce970a9e23b1d0e880e7a6d
@@ -264,7 +264,15 @@ class Rex::Socket::Comm::Local
264
264
  sock.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_REUSEADDR, true)
265
265
  end
266
266
 
267
- sock.bind(Rex::Socket.to_sockaddr(param.localhost, param.localport))
267
+ if Rex::Socket.is_ip_addr?(param.localhost)
268
+ ip = param.localhost
269
+ elsif param.v6
270
+ ip = Rex::Socket.getaddresses(param.localhost, true).select { |address| Rex::Socket.is_ipv6?(address) }.sample
271
+ else
272
+ ip = Rex::Socket.getaddresses(param.localhost, false).select { |address| Rex::Socket.is_ipv4?(address) }.sample
273
+ end
274
+
275
+ sock.bind(Rex::Socket.to_sockaddr(ip, param.localport))
268
276
 
269
277
  rescue ::Errno::EADDRNOTAVAIL,::Errno::EADDRINUSE
270
278
  sock.close
@@ -343,7 +351,13 @@ class Rex::Socket::Comm::Local
343
351
  ip = param.proxies.first.host
344
352
  port = param.proxies.first.port
345
353
  else
346
- ip = Rex::Socket.getaddress(param.peerhost)
354
+ if Rex::Socket.is_ip_addr?(param.peerhost)
355
+ ip = param.peerhost
356
+ elsif param.v6
357
+ ip = Rex::Socket.getaddresses(param.peerhost, true).select { |address| Rex::Socket.is_ipv6?(address) }.sample
358
+ else
359
+ ip = Rex::Socket.getaddresses(param.peerhost, false).select { |address| Rex::Socket.is_ipv4?(address) }.sample
360
+ end
347
361
  port = param.peerport
348
362
  end
349
363
 
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.66"
3
+ VERSION = "0.1.67"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rex-socket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.66
4
+ version: 0.1.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-21 00:00:00.000000000 Z
11
+ date: 2026-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake