diff --git a/lib/rapid7/nexpose.rb b/lib/rapid7/nexpose.rb index 710e364332..2939ab8c24 100644 --- a/lib/rapid7/nexpose.rb +++ b/lib/rapid7/nexpose.rb @@ -182,6 +182,25 @@ class APIRequest end end + @res.elements.each('//Failure') do |s| + + # 1.1 returns lower case elements + s.elements.each('message') do |m| + @error = m.text + end + s.elements.each('stacktrace') do |m| + @trace = m.text + end + + # 1.2 returns capitalized elements + s.elements.each('Message') do |m| + @error = m.text + end + s.elements.each('Stacktrace') do |m| + @trace = m.text + end + end + # This is a hack to handle corner cases where a heavily loaded Nexpose instance # drops our HTTP connection before processing. We try 5 times to establish a # connection in these situations. The actual exception occurs in the Ruby diff --git a/plugins/nexpose.rb b/plugins/nexpose.rb index 56b0bd1830..00c1173bc1 100644 --- a/plugins/nexpose.rb +++ b/plugins/nexpose.rb @@ -520,7 +520,14 @@ class Plugin::Nexpose < Msf::Plugin print_status(" >> Created temporary report configuration ##{report.config_id}") if opt_verbose # Run the scan - res = site.scanSite() + begin + res = site.scanSite() + rescue Nexpose::APIError => e + nexpose_error_message = e.message + nexpose_error_message.gsub!(/NexposeAPI: Action failed: /, '') + print_error "#{nexpose_error_message}" + return + end sid = res[:scan_id] print_status(" >> Scan has been launched with ID ##{sid}") if opt_verbose