Skip to content

Commit

Permalink
Land rapid7#3195, check() fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tod Beardsley committed Apr 10, 2014
2 parents 9ca3d95 + d385c5a commit bc5f87b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/msf/ui/console/module_command_dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,25 @@ def check_simple(instance=nil)
end

rhost = instance.rhost
rport = instance.rport
rport = nil
peer = rhost
if instance.datastore['rport']
rport = instance.rport
peer = "#{rhost}:#{rport}"
end

begin
code = instance.check_simple(
'LocalInput' => driver.input,
'LocalOutput' => driver.output)
if (code and code.kind_of?(Array) and code.length > 1)
if (code == Msf::Exploit::CheckCode::Vulnerable)
print_good("#{rhost}:#{rport} - #{code[1]}")
print_good("#{peer} - #{code[1]}")
else
print_status("#{rhost}:#{rport} - #{code[1]}")
print_status("#{peer} - #{code[1]}")
end
else
print_error("#{rhost}:#{rport} - Check failed: The state could not be determined.")
print_error("#{peer} - Check failed: The state could not be determined.")
end
rescue ::Rex::ConnectionError, ::Rex::ConnectionProxyError, ::Errno::ECONNRESET, ::Errno::EINTR, ::Rex::TimeoutError, ::Timeout::Error
# Connection issues while running check should be handled by the module
Expand All @@ -186,7 +191,7 @@ def check_simple(instance=nil)
rescue Msf::OptionValidateError => e
print_error("Check failed: #{e.message}")
rescue ::Exception => e
print_error("#{rhost}:#{rport} - Check failed: #{e.class} #{e}")
print_error("#{peer} - Check failed: #{e.class} #{e}")
end
end

Expand Down

0 comments on commit bc5f87b

Please sign in to comment.