add exploit datastore to sessions so we can tell exactly how the session was created

git-svn-id: file:///home/svn/framework3/trunk@8651 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
James Lee 2010-02-26 01:09:23 +00:00
parent d5e07a3ba9
commit 832d0bcbfa
3 changed files with 16 additions and 5 deletions

View File

@ -139,6 +139,14 @@ class DataStore < Hash
return str
end
def to_h
datastore_hash = {}
self.keys.each do |k|
datastore_hash[k.to_s] = self[k].to_s
end
datastore_hash
end
#
# Persists the contents of the data store to a file
#

View File

@ -203,10 +203,7 @@ class FrameworkEventSubscriber
include GeneralEventSubscriber
def on_module_run(instance)
if framework.db.active
datastore_hash = {}
instance.datastore.keys.each do |k|
datastore_hash[k.to_s] = instance.datastore[k].to_s
end
datastore_hash = instance.datastore.to_h
info = {}
info[:workspace] = framework.db.find_workspace(instance.workspace),
@ -259,7 +256,8 @@ class FrameworkEventSubscriber
require 'msf/core/session'
include ::Msf::SessionEvent
def on_session_open(session)
session_event('session_open', session)
opts = { :datastore => session.exploit_datastore.to_h }
session_event('session_open', session, opts)
end
def on_session_close(session, reason='')

View File

@ -190,6 +190,7 @@ module Session
}
self.target_host = m.target_host
self.workspace = m.workspace
self.exploit_datastore = m.datastore
end
#
@ -259,6 +260,10 @@ module Session
#
attr_accessor :target_host
#
# The datastore of the exploit that created this session
#
attr_accessor :exploit_datastore
#
# The specific identified session info
#
attr_accessor :info