rex-socket 0.1.67 → 0.1.68

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: d08e421781956b8e7f7cae6c731fb1589401f375774dbe51fde3dba15170ae3c
4
- data.tar.gz: 646375e1d851896604d9b4b342bc1158fb0628b42a659fe58622551a66bb097d
3
+ metadata.gz: 27acb62e9f5a756af4be153428826989e9287a3c61cf42ab472f531459ce4e6a
4
+ data.tar.gz: 6aaf1a0a93ce1563f3c2c0d2fb02e2f8fca12767e0bdad54e2bac13a19381ee5
5
5
  SHA512:
6
- metadata.gz: 850daee218c584254d1eaf047ad3843b4fcaa648a83add08ae29c71c9142be59613239e6bf46c7c1996b3710bfb02b271320f62ff8d55b3f93c1a2073bd286a2
7
- data.tar.gz: 3fc4e74930e01ff0a54a22b7f135e83e49693a053b397619b00b2e7ede551cfd4875946c00d46fa537508266c2c79ca68af5d87e0ce970a9e23b1d0e880e7a6d
6
+ metadata.gz: '0481a40864ca7aad2d346f510024ccff891f218b3ebbcea572e9342424d730241829218b4d0eadb69812c79fd4fa9e5a6b9e03749ee8eb22ac61ee71278ed5a3'
7
+ data.tar.gz: 7de451e877c242251ab8a004dc806f4465849748696547b752168dbb58c24b48fb25e95771656da33a89a989f68b7030e58579f5b38a92f91bef35e50572c600
@@ -97,23 +97,41 @@ module Rex::Socket::Udp
97
97
  #
98
98
  # Sends a datagram to the supplied host:port with optional flags.
99
99
  #
100
+ # @deprecated Use {#send} with the stdlib 4-arg form send(mesg, flags, host, port) instead.
101
+ # Note the argument order differs: sendto(gram, host, port, flags) vs send(mesg, flags, host, port).
102
+ #
100
103
  def sendto(gram, peerhost, peerport, flags = 0)
104
+ warn "#{self.class}#sendto is deprecated; use send(mesg, flags, host, port) instead", uplevel: 1
105
+ send(gram, flags, peerhost, peerport)
106
+ end
101
107
 
102
- # Catch unconnected IPv6 sockets talking to IPv4 addresses
103
- peer = Rex::Socket.resolv_nbo(peerhost)
104
- if (peer.length == 4 and self.ipv == 6)
105
- peerhost = Rex::Socket.getaddress(peerhost, true)
106
- if peerhost[0,7].downcase != '::ffff:'
107
- peerhost = '::ffff:' + peerhost
108
+ #
109
+ # Sends a datagram using the stdlib 4-arg form send(mesg, flags, host, port).
110
+ #
111
+ # The 4-arg form handles IPv6/IPv4 address mapping and dispatches via
112
+ # BasicSocket#send with a packed sockaddr, so channel/pivoted sockets that
113
+ # override sendto are not involved. Also accepts the 3-arg sockaddr form used
114
+ # by lower-level callers, and the 2-arg connected-socket form.
115
+ #
116
+ def send(mesg, flags, host = nil, port = nil)
117
+ if host && port
118
+ # Catch unconnected IPv6 sockets talking to IPv4 addresses
119
+ peer = Rex::Socket.resolv_nbo(host)
120
+ if peer.length == 4 && self.ipv == 6
121
+ host_address = Rex::Socket.getaddress(host, true)
122
+ host = '::ffff:' + host_address unless host_address.downcase.start_with?('::ffff:')
108
123
  end
124
+ begin
125
+ super(mesg, flags, Rex::Socket.to_sockaddr(host, port))
126
+ rescue ::Errno::EHOSTUNREACH, ::Errno::ENETDOWN, ::Errno::ENETUNREACH, ::Errno::ENETRESET,
127
+ ::Errno::EHOSTDOWN, ::Errno::EACCES, ::Errno::EINVAL, ::Errno::EADDRNOTAVAIL
128
+ nil
129
+ end
130
+ elsif host
131
+ super(mesg, flags, host)
132
+ else
133
+ super(mesg, flags)
109
134
  end
110
-
111
- begin
112
- send(gram, flags, Rex::Socket.to_sockaddr(peerhost, peerport))
113
- rescue ::Errno::EHOSTUNREACH,::Errno::ENETDOWN,::Errno::ENETUNREACH,::Errno::ENETRESET,::Errno::EHOSTDOWN,::Errno::EACCES,::Errno::EINVAL,::Errno::EADDRNOTAVAIL
114
- return nil
115
- end
116
-
117
135
  end
118
136
 
119
137
  #
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.67"
3
+ VERSION = "0.1.68"
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.67
4
+ version: 0.1.68
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-05-27 00:00:00.000000000 Z
11
+ date: 2026-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake