Working IPv4 & IPv6 DNS resolution for single and multiple hosts #684
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.
This PR adds returning of multiple IPv4 and IPv6 addresses for a single host and multiple hosts. This is thanks to the new TLV group type,
TLV_TYPE_RESOLVE_HOST_ENTRY
, that comes from the pre-requisite PR here: rapid7/metasploit-framework#18499I've changed the
DWORD resolve_host
function to now return the whole addrinfo structure, rather than only a single IP. This means that we now need to callfreeaddrinfo()
on the result to ensure proper cleanup.Before
IPv4: Calling
irb -e "puts framework.sessions.values.last.net.resolve.resolve_hosts ['google.com', 'bing.com', 'duckduckgo.com', 'cloudflare.com', 'slack.com', 'rapid7.com'], 2"
IPv6: Calling
irb -e "puts framework.sessions.values.last.net.resolve.resolve_hosts ['localhost', 'mytestdns'], 23"
After
IPv4: Calling
irb -e "puts framework.sessions.values.last.net.resolve.resolve_hosts ['google.com', 'bing.com', 'duckduckgo.com', 'cloudflare.com', 'slack.com', 'rapid7.com'], 2"
IPv6: Calling
irb -e "puts framework.sessions.values.last.net.resolve.resolve_hosts ['google.com', 'example.com'], 23"