Fix .rex_getaddrinfo inconsistencies #67
Merged
+162
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
.rex_getaddrinfo
method behaves inconsistently withAddrinfo.getaddrinfo
, which makes.getaddresses
inconsistent depending on if a resolver is present or not. When no resolver is present, a numeric address (either decimal or hex, not binary or octal) is specified, it's converted to an IPv4 address:But when a resolver is present,
.getaddresses
will call.rex_getaddrinfo
and it falls with a resolution error because the address is not a valid hostname:This came up as an issue that prevents Metasploit's route command from working when invoked as
route add 0 0 -1
to add a default route for all IPv4 addresses through the most recent session when the DNS feature is enabled. This also removes references to::Net::DNS
in favor of using the constants fromDnsruby::Types
instead, which was already referenced but not defined as a requirement. Adding Dnsruby as a requirement was needed to make the tests work.