rex-socket 0.1.54 → 0.1.55

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: 0d6178ec17a488e30e67e5f38c47a37ef101779a01819acc9fe5f0e77e21137a
4
- data.tar.gz: 850e34b302ac851ef01ed341fdb361e60c6256a3be7ebec6f52398046884b041
3
+ metadata.gz: f205a57e2e9e372f999bd08d4e39d6be05bb5fc4a3bcc83e3b27b0de29dd90ad
4
+ data.tar.gz: '028fca6197d04804b78b7f6ee8d9ca849196c84714a1eabf640b25fe723b8226'
5
5
  SHA512:
6
- metadata.gz: 0e6be5fbc26e756be673e373c521ddac5b1b98a999ee5c78d9d9d009a68d9de1d5a40f2915ebb226a0349c4dd097d76779c2181396be31756f2a95c77f0fabff
7
- data.tar.gz: 9bcd47ba675dd95f6eb4d5164e94ed5c82d1ac0f36513a20b2c77a37089f6a3cbe0705027ad363e153a700e45e9493b449e6659dc73e6256d20e83188e15c089
6
+ metadata.gz: 393eb18d30bf96737c546a91cc646991cb1b17641cce3266911378a6a423c1d7a3f0e921ca455816bf7563fae6fa6933a38a39263c5b7a823be1c319ff0d8960
7
+ data.tar.gz: c5f866f117febd1717a60404a2b07e5cf945f48c37c479e490d26992b5438abfb78f1b7e84940399e0e741ef155830ec07cb7fa5ef211fb88d70e7b33341e9de
checksums.yaml.gz.sig CHANGED
Binary file
data/cortex.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ info:
3
+ title: Rex Socket
4
+ description: The Rex Socket Abstraction Library
5
+ x-cortex-git:
6
+ github:
7
+ alias: r7org
8
+ repository: rapid7/rex-socket
9
+ x-cortex-tag: rex-socket
10
+ x-cortex-type: service
11
+ x-cortex-domain-parents:
12
+ - tag: metasploit
13
+ openapi: 3.0.1
14
+ servers:
15
+ - url: "/"
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Socket
3
- VERSION = "0.1.54"
3
+ VERSION = "0.1.55"
4
4
  end
5
5
  end
data/lib/rex/socket.rb CHANGED
@@ -258,6 +258,29 @@ module Socket
258
258
  @@resolver ? self.rex_gethostbyname(host) : ::Socket.gethostbyname(host)
259
259
  end
260
260
 
261
+ #
262
+ # Wrapper for Resolv::DNS.getresources which normalizes the return value to a
263
+ # list of hostnames regardless of the resource class.
264
+ #
265
+ # @param name [String] The name to lookup.
266
+ # @param typeclass [Symbol] The resource class to lookup, e.g. CNAME, MX, etc.
267
+ # @raises ArgumentError An argument error is raised when the typeclass is invalid.
268
+ # @return [Array<String>] The hostnames that were returned by the query.
269
+ def self.getresources(name, typeclass)
270
+ return self.rex_getresources(name, typeclass) if @@resolver
271
+
272
+ typeclass = typeclass.upcase
273
+ attribute = DNS_RESOURCE_ATTRIBUTE_NAMES[typeclass]
274
+ if attribute.nil?
275
+ raise ArgumentError, "Invalid typeclass: #{typeclass}"
276
+ end
277
+ const = Resolv::DNS::Resource::IN.const_get(typeclass)
278
+
279
+ dns = Resolv::DNS.new
280
+ resources = dns.getresources(name, const)
281
+ resources.map(&attribute).map(&:to_s)
282
+ end
283
+
261
284
  #
262
285
  # Create a sockaddr structure using the supplied IP address, port, and
263
286
  # address family
@@ -963,6 +986,52 @@ protected
963
986
  # Ensure response types (depending on underlying library used) provide required methods
964
987
  return v4, v6
965
988
  end
989
+
990
+ def self.rex_getresources(name, typeclass, resolver: @@resolver)
991
+ raise ::SocketError.new(
992
+ "Rex::Socket internal DNS resolution requires passing/setting a resolver"
993
+ ) unless resolver
994
+ raise ::SocketError.new(
995
+ "Rex::Socket internal DNS resolution requires passing a String name to resolve"
996
+ ) unless name.is_a?(String)
997
+
998
+ typeclass = typeclass.upcase
999
+ attribute = REX_DNS_RESOURCE_ATTRIBUTE_NAMES[typeclass]
1000
+ if attribute.nil?
1001
+ raise ArgumentError, "Invalid typeclass: #{typeclass}"
1002
+ end
1003
+ const = ::Net::DNS.const_get(typeclass)
1004
+
1005
+ resources = begin
1006
+ resolver.send(name, const).answer.select do |a|
1007
+ a.type == const
1008
+ end.map(&attribute).map(&:to_s)
1009
+ rescue
1010
+ []
1011
+ end
1012
+
1013
+ resources
1014
+ end
1015
+
1016
+ DNS_RESOURCE_ATTRIBUTE_NAMES = {
1017
+ CNAME: :name,
1018
+ MX: :exchange,
1019
+ NS: :name,
1020
+ PTR: :name,
1021
+ SOA: :mname,
1022
+ SRV: :target
1023
+ }.freeze
1024
+ private_constant :DNS_RESOURCE_ATTRIBUTE_NAMES
1025
+
1026
+ REX_DNS_RESOURCE_ATTRIBUTE_NAMES = {
1027
+ CNAME: :domainname,
1028
+ MX: :exchange,
1029
+ NS: :domainname,
1030
+ PTR: :domainname,
1031
+ SOA: :mname,
1032
+ SRV: :target
1033
+ }.freeze
1034
+ private_constant :REX_DNS_RESOURCE_ATTRIBUTE_NAMES
966
1035
  end
967
1036
 
968
1037
  end
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- |
2
- �$�I(��px�Z��}����=;;�7���6pdN؊���m��sJ���3���!Aʊ!�Lo
3
- ��U#&ܮ��} �a<M�5)1]#��G����M��>�ʹA��2v(�j��^��κ�����C��H)ު������l�`Vy�� u�������"fӉwFQ�Yߒ�F�z��̆�T�|�9���`�H̒��(��Jע
1
+ ͂�-T'[�Ss�eq�KqS42��aH�Ɣn�5q�vB���#�x�,�C�3}����&96�{ �ϔ 8� k|�����-�Xa���J#PJ��I��:ĈΪ��;] ���o/"�ܸi�V炜�<��(�h��uM�ZQ�L�1���.����V/���ƥ���׹��H6Ҡ���2+i�f^��4�T/�cQu+�zxlƆD��Ǻ�<g�i0џ
2
+ ��z#9j���� ~���a>�BR��
3
+ �8�\�yZS}]0�׃�l�E������z <(
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.54
4
+ version: 0.1.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -10,90 +10,31 @@ bindir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ydHMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0U0hBMkFzc3Vy
88
- ZWRJRENvZGVTaWduaW5nQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEL
89
- BQADggEBAN+GL5/myPWg7oH4mVrG7/OhXF1MoYQF0ddaNiqaweEHMuKJBQCVZRbL
90
- 37HojoKXXv2yyRJBCeTB+ojrxX+5PdLVZa0ss7toWzJ2A1poPXZ1eZvm5xeFD32z
91
- YQaTmmNWNI3PCDTyJ2PXUc+bDiNNwcZ7yc5o78UNRvp9Jxghya17Q76c9Ov9wvnv
92
- dxxQKWGOQy0m4fBrkyjAyH9Djjn81RbQrqYgPuhd5nD0HjN3VUQLhQbIJrk9TVs0
93
- EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
- 9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
- -----END CERTIFICATE-----
96
- date: 2023-09-13 00:00:00.000000000 Z
37
+ date: 2023-12-05 00:00:00.000000000 Z
97
38
  dependencies:
98
39
  - !ruby/object:Gem::Dependency
99
40
  name: rake
@@ -157,6 +98,7 @@ files:
157
98
  - Rakefile
158
99
  - bin/console
159
100
  - bin/setup
101
+ - cortex.yaml
160
102
  - lib/rex/socket.rb
161
103
  - lib/rex/socket/comm.rb
162
104
  - lib/rex/socket/comm/local.rb
metadata.gz.sig CHANGED
Binary file