host is always an Mdm::Host, don't look it up again

bug/bundler_fix
James Lee 2015-03-27 11:34:32 -05:00
parent 466ef4349e
commit 3b8d70b567
No known key found for this signature in database
GPG Key ID: 2D6094C7CEA0A321
1 changed files with 5 additions and 12 deletions

View File

@ -76,10 +76,10 @@ module Msf::DBManager::ExploitAttempt
:username => username || "unknown",
}
# Report a vuln_attempt if we found a match
# We have match, lets create a vuln_attempt record
if vuln
vuln.vuln_attempts.create(attempt_info)
attempt_info[:vuln_id] = vuln.id
vuln.vuln_attempts.create(attempt_info)
end
# Report an exploit attempt all the same
@ -99,8 +99,8 @@ module Msf::DBManager::ExploitAttempt
end
def report_exploit_success(opts)
::ActiveRecord::Base.connection_pool.with_connection {
::ActiveRecord::Base.connection_pool.with_connection {
wspace = opts.delete(:workspace) || workspace
mrefs = opts.delete(:refs) || return
host = opts.delete(:host)
@ -113,14 +113,7 @@ module Msf::DBManager::ExploitAttempt
username = opts.delete(:username)
mname = opts.delete(:module)
# Look up or generate the host as appropriate
if not (host and host.kind_of? ::Mdm::Host)
if svc.kind_of? ::Mdm::Service
host = svc.host
else
host = report_host(:workspace => wspace, :address => host )
end
end
# Bail if we dont have a host object
return if not host
@ -150,13 +143,13 @@ module Msf::DBManager::ExploitAttempt
:module => mname,
:username => username || "unknown",
}
attempt_info[:session_id] = opts[:session_id] if opts[:session_id]
attempt_info[:loot_id] = opts[:loot_id] if opts[:loot_id]
# We have match, lets create a vuln_attempt record
if vuln
attempt_info[:vuln_id] = vuln.id,
vuln.vuln_attempts.create(attempt_info)
# Correct the vuln's associated service if necessary