From e0f11992af1db4b4c23ee987f19fbca4a0b373c7 Mon Sep 17 00:00:00 2001 From: David Maloney Date: Wed, 15 Feb 2012 02:12:06 -0600 Subject: [PATCH] Gah screwed up that commit, accidentally chunked out the rescues. --- lib/msf/core/exploit/vim_soap.rb | 27 ++++++++++++------- .../scanner/vmware/vmware_http_login.rb | 8 +++++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/msf/core/exploit/vim_soap.rb b/lib/msf/core/exploit/vim_soap.rb index b34bca1899..a540af278b 100644 --- a/lib/msf/core/exploit/vim_soap.rb +++ b/lib/msf/core/exploit/vim_soap.rb @@ -60,6 +60,7 @@ module Exploit::Remote::VIMSoap def vim_get_session_list + vim_setup_references soap_req = %Q| @@ -78,15 +79,23 @@ module Exploit::Remote::VIMSoap | - res = send_request_cgi({ - 'uri' => '/sdk', - 'method' => 'POST', - 'agent' => 'VMware VI Client', - 'cookie' => @vim_cookie, - 'data' => soap_req, - 'headers' => { 'SOAPAction' => @soap_action} - }, 25) - print_status res.body + res = send_request_cgi({ + 'uri' => '/sdk', + 'method' => 'POST', + 'agent' => 'VMware VI Client', + 'cookie' => @vim_cookie, + 'data' => soap_req, + 'headers' => { 'SOAPAction' => @soap_action} + }, 25) + return :noresponse unless res + if res.body.include? "NotAuthenticatedFault" + return :expired + elsif res.body.include? "" + return :error + end + session_list = [] + session_list << Hash.from_xml(res.body)['Envelope']['Body']['RetrievePropertiesResponse']['returnval']['propSet']['val'] + return session_list.flatten.compact end diff --git a/modules/auxiliary/scanner/vmware/vmware_http_login.rb b/modules/auxiliary/scanner/vmware/vmware_http_login.rb index 4e8da379a2..c0942ce4a3 100644 --- a/modules/auxiliary/scanner/vmware/vmware_http_login.rb +++ b/modules/auxiliary/scanner/vmware/vmware_http_login.rb @@ -64,7 +64,13 @@ class Metasploit3 < Msf::Auxiliary else vprint_error("http://#{ip}:#{rport} - No response") end - + rescue ::Rex::ConnectionError => e + vprint_error("http://#{ip}:#{rport}#{datastore['URI']} - #{e}") + return false + rescue + vprint_error("Skipping #{ip} due to error - #{e}") + return false + end end