-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve host mixin #19854
Resolve host mixin #19854
Conversation
bf48a18
to
a57ccc3
Compare
resolved_host.reject { |k, _v| k == :ip } | ||
else | ||
ips = [] | ||
data = cmd_exec("nslookup #{host}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nslookup
is Windows-specific, yet the resolve_host
method doesn't seem to be platform-specific
a57ccc3
to
dea28d1
Compare
if resolved_host[:ips].empty? | ||
false | ||
else | ||
resolved_host[:ips].each do |ip| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a bug here, maybe worth double checking this works as expected
if resolved_host[:ips].empty? | ||
false | ||
else | ||
resolved_host[:ips].each do |ip| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the above comment
Closed in favour off combining these changes with #18499 |
Note
TODO: Update tests to not resolve against google.com
This PR builds on a previous PR, specifically this comment thread.
This new mixin allows for DNS resolution for modules with multiple session types. E.g.
modules/post/windows/gather/enum_computers.rb
supports multiple sessions:However the resolution across these session requires different logic. Meterpreter will now make use of the new Meterpreter API changes that will NEED to be landed before this PR can land.
metasploit-payloads PR - rapid7/metasploit-payloads#681
metasploit-framework PR - #18499
The mixin will check if we have a Meterpreter session with access to the
net
library and use the new Meterpreter API if so, otherwise fallback tonslookup
if not.Note
A rescue was added to the
enum_computers
module to allow for instances when the DNS isn't able to be resolved via the meterpreter API. This is due to inconsistent resolving methods in the runtime languages.With no errors
With every entry returning an error
Mixed results
Verification
List the steps needed to make sure this thing works
msfconsole
use post/windows/gather/enum_computers.rb
Example: