rex-socket 0.1.51 → 0.1.52

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: 4c8f90acc30e263d824f20d2b1286a5520a483945985f3f229a58bfcf5b9cde1
4
- data.tar.gz: 41bd0a0c06187b1be6a0b7672b3efd36d100b74ced4dfd9709aeca71cc7c91cc
3
+ metadata.gz: 69a97cac39e77ee44665aa30e9b9d5d30fa490c1cbb0909cfeda49bce7ca1414
4
+ data.tar.gz: 3e76c09d2320265208f8a91c8bd93730d4d4698d1940b8a654d7ec553c008b6d
5
5
  SHA512:
6
- metadata.gz: dd89e2260a36ebc22e7eb69a1035078f8aceb96c664dde36f7849a76020f8cf8fd276686cc01e857b5a203a59624b34818271dcdd5c01a6789475cf22cadccf1
7
- data.tar.gz: d2e464106473a60359fa268bbe00b1eafac147c9c35b2ef82503824534c5c85fa223bd17decf0dd05d29daa5c36101398ab9a99e8b6afb4000ab01e249262a77
6
+ metadata.gz: 475846de509a2f145142566a729b7fa4bf1d67d0d993c2cff20edb2bf7418c64930136d5e34f8a05a717da610c3dc734d4b631cb66611d3725a173f53a6d3001
7
+ data.tar.gz: 355abe15808629534099238aad2fee65e4588573108aa4307aa6bc45b1addca4bc6422d48bb77b288945d8b33956be4503a842f74f8e14c0ecc283fcaa45ca9b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.51"
3
+ VERSION = "0.1.52"
4
4
  end
5
5
  end
data/lib/rex/socket.rb CHANGED
@@ -157,7 +157,33 @@ module Socket
157
157
  (support_ipv6? && addr =~ MATCH_IPV6) || (addr =~ MATCH_IPV4)
158
158
  end
159
159
 
160
- #
160
+ # Checks to see if an address is an IPv6 address and if so, converts it into its
161
+ # square bracket format for addressing as noted in RFC 6874 which states that an IPv6
162
+ # address literal in a URL is always embedded between [ and ]. Please also refer to
163
+ # RFC5952, RFC3986, and RFC6874 for more info.
164
+ #
165
+ # RFC3986 section 3.2.2 specifically notes "A host identified by an Internet Protocol literal address, version 6
166
+ # [RFC3513] or later, is distinguished by enclosing the IP literal
167
+ # within square brackets ("[" and "]"). This is the only place where
168
+ # square bracket characters are allowed in the URI syntax."
169
+ #
170
+ # RFC6874 reinforces this in section 2 where it notes "In a URI, a literal IPv6 address
171
+ # is always embedded between '[' and ']'".
172
+ #
173
+ # @param host [String] IP address or hostname to convert to a URI authority.
174
+ # @param port [Integer] Port number to include within the URI authority.
175
+ # @return [String] Returns the URI authority string.
176
+ # @raise [ArgumentError] This function will raise an ArgumentError if the host parameter is not a String.
177
+ def self.to_authority(host, port=nil)
178
+ unless host.kind_of?(String)
179
+ raise ArgumentError.new("Expected a string for the host parameter!")
180
+ end
181
+ host = "[#{host}]" if is_ipv6?(host)
182
+ host += ":#{port}" if port
183
+ host
184
+ end
185
+
186
+
161
187
  # Return true if +addr+ is within the ranges specified in RFC1918, or
162
188
  # RFC5735/RFC3927
163
189
  #
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.51
4
+ version: 0.1.52
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: 2023-05-17 00:00:00.000000000 Z
96
+ date: 2023-06-09 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- .:e* ���k+�b�X'�����]p7/��@��J<+��� &Q��o��Kw#��
1
+ �vK�W.Ci��e 0���*��{�3u�^T��ruI[�A=4K1�\~
2
+ 戔>����������8������9֏çayayf�Q�ap��j���c�w�!� �^��%͸݅2͠,5<Ԝ��>��7�ɫ>�3�#���̣=��YG��i��L>��t����,�k��O��{�ڇ9�|�(��V������q6��{8�U�󫕠>�*y�@@#?�.��;H:)02j�5�<�iUж���0ʲ>����l����g[x��