466c97f114
* Move the @current_workspace tracking to workspace proxy * Create helper for handling workspace value in opts * Call framework.db.proxy across dbmanager files now that active ws is tracked in proxy NOTE: This commit throws an exception when adding a remote data service.
22 lines
686 B
Ruby
22 lines
686 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].kind_of? ::Mdm::Host and opts[:host]
|
|
opts[:host] = report_host(:workspace => wspace, :host => opts[:host])
|
|
end
|
|
|
|
::Mdm::Event.create(opts.merge(:workspace_id => wspace[:id], :username => uname))
|
|
}
|
|
end
|
|
end |