22 lines
693 B
Ruby
22 lines
693 B
Ruby
module Msf::DBManager::Event
|
|
def events(wspace=workspace)
|
|
::ActiveRecord::Base.connection_pool.with_connection {
|
|
wspace.events.find :all, :order => 'created_at ASC'
|
|
}
|
|
end
|
|
|
|
def report_event(opts = {})
|
|
return if not active
|
|
::ActiveRecord::Base.connection_pool.with_connection {
|
|
wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)
|
|
return if not wspace # Temp fix?
|
|
uname = opts.delete(:username)
|
|
|
|
if !opts[:host].nil? && !opts[:host].kind_of?(::Mdm::Host)
|
|
opts[:host] = find_or_create_host(workspace: wspace, host: opts[:host])
|
|
end
|
|
|
|
::Mdm::Event.create(opts.merge(:workspace_id => wspace[:id], :username => uname))
|
|
}
|
|
end
|
|
end |