Landing #7517 Nexpose API error fix

bug/bundler_fix
Brian Patterson 2016-11-01 12:02:35 -05:00
commit 51ad285521
No known key found for this signature in database
GPG Key ID: 79C4E4506D8A9C42
2 changed files with 27 additions and 1 deletions

View File

@ -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

View File

@ -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