Re-enable host lookup for _failure
Again needed when called from exploit_driver because nothing is reported yet at that point. Also adds some yardocbug/bundler_fix
parent
f0eeef3cbb
commit
374db22d5b
|
@ -27,6 +27,11 @@ module Msf::DBManager::ExploitAttempt
|
|||
}
|
||||
end
|
||||
|
||||
# Create an `Mdm::ExploitAttempt` (and possibly an `Mdm::VulnAttempt`, if
|
||||
# the `vuln` option is passed).
|
||||
#
|
||||
# @option (see #do_report_failure_or_success)
|
||||
# @return (see #do_report_failure_or_success)
|
||||
def report_exploit_failure(opts)
|
||||
return unless opts.has_key?(:refs) && !opts[:refs].blank?
|
||||
host = opts[:host] || return
|
||||
|
@ -39,14 +44,31 @@ module Msf::DBManager::ExploitAttempt
|
|||
# Look up the service as appropriate
|
||||
if port and svc.nil?
|
||||
opts[:proto] ||= prot
|
||||
opts[:service] = get_service(wspace, host, prot, port)
|
||||
svc = opts[:service] = get_service(wspace, host, prot, port)
|
||||
end
|
||||
|
||||
# Look up the host as appropriate
|
||||
if !host || !host.kind_of?(::Mdm::Host)
|
||||
if svc.kind_of? ::Mdm::Service
|
||||
host = svc.host
|
||||
else
|
||||
host = get_host(workspace: wspace, address: host)
|
||||
end
|
||||
end
|
||||
|
||||
# Bail if we dont have a host object
|
||||
return if not host
|
||||
opts[:host] = host
|
||||
|
||||
do_report_failure_or_success(opts)
|
||||
end
|
||||
|
||||
# Create an `Mdm::ExploitAttempt` (and possibly an `Mdm::VulnAttempt`, if
|
||||
# the `vuln` option is passed).
|
||||
#
|
||||
# @return (see #do_report_failure_or_success)
|
||||
def report_exploit_success(opts)
|
||||
opts[:refs] || return
|
||||
return unless opts[:refs]
|
||||
host = opts[:host] || return
|
||||
|
||||
wspace = opts[:workspace] || workspace
|
||||
|
@ -67,6 +89,16 @@ module Msf::DBManager::ExploitAttempt
|
|||
|
||||
private
|
||||
|
||||
# @option opts [Array<String>, Array<Msf::Module::Reference>] :refs
|
||||
# @option opts [Mdm::Host] :host
|
||||
# @option opts [Mdm::Service] :service
|
||||
# @option opts [Integer] :port (nil)
|
||||
# @option opts ["tcp","udp"] :proto (nil)
|
||||
# @option opts [Mdm::Vuln] :vuln (nil)
|
||||
# @option opts [Time] :timestamp (nil)
|
||||
# @option opts [Mdm::Vuln] :timestamp (nil)
|
||||
# @option opts [String] :module (nil)
|
||||
# @return [void]
|
||||
def do_report_failure_or_success(opts)
|
||||
::ActiveRecord::Base.connection_pool.with_connection {
|
||||
mrefs = opts.delete(:refs) || return
|
||||
|
|
Loading…
Reference in New Issue