Rework vuln lookup logic to account for vuln with no service (nexpose import vuln with -1 port)

MSP-13234
bug/bundler_fix
Fernando Arias 2015-09-09 13:21:05 -05:00
parent e88a14aee6
commit 0bb03db786
No known key found for this signature in database
GPG Key ID: 89EC07CE01DF79A1
4 changed files with 5 additions and 8 deletions

View File

@ -165,7 +165,7 @@ module Exploit
self.error = e
# Record the detailed reason
self.exploit.fail_detail ||= e.to_s
self.fail_detail ||= e.to_s
msg
end
@ -175,9 +175,6 @@ module Exploit
def handle_exception e
msg = setup_fail_detail_from_exception e
require 'pry'
binding.pry
case e
when Msf::Exploit::Complete
# Nothing to show in this case
@ -235,8 +232,6 @@ module Exploit
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
end
# Record the error to various places
self.framework.events.on_module_error(self, msg)

View File

@ -119,6 +119,7 @@ module Msf::DBManager::ExploitAttempt
username = opts[:username]
mname = opts[:module]
if vuln.nil?
ref_names = mrefs.map { |ref|
if ref.respond_to?(:ctx_id) and ref.respond_to?(:ctx_val)

View File

@ -46,7 +46,8 @@ module Msf::DBManager::Vuln
def find_vuln_by_refs(refs, host, service=nil)
ref_ids = refs.find_all { |ref| ref.name.starts_with? 'CVE-'}
host.vulns.includes(:refs).where(service_id: service.try(:id), refs: { id: ref_ids}).first
relation = host.vulns.includes(:refs)
relation.where(service_id: service.try(:id), refs: { id: ref_ids}).first || relation.where(refs: { id: ref_ids}).first
end
def get_vuln(wspace, host, service, name, data='')

View File

@ -1260,7 +1260,6 @@ class Exploit < Msf::Module
end
def report_failure
return unless framework.db and framework.db.active
info = {
@ -1293,6 +1292,7 @@ class Exploit < Msf::Module
)
end
framework.db.report_exploit_failure(info)
end