Store session UUID and username

git-svn-id: file:///home/svn/framework3/trunk@8830 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-03-16 15:11:07 +00:00
parent f9267498e3
commit 18075f9b68
3 changed files with 27 additions and 6 deletions

View File

@ -247,8 +247,13 @@ class FrameworkEventSubscriber
:name => name,
:host => address,
:info => {
:session_id => session.sid,
:via_exploit => session.via_exploit
:session_id => session.sid,
:session_info => session.info,
:session_uuid => session.uuid,
:username => session.username,
:target_host => session.target_host,
:via_exploit => session.via_exploit,
:via_payload => session.via_payload
}.merge(opts)
}
report_event(event)

View File

@ -308,6 +308,13 @@ class Module
(framework.db and framework.db.active and framework.db.workspace and framework.db.workspace.name)
end
#
# Returns the username that instantiated this module
#
def owner
self.datastore['MODULE_OWNER']
end
#
# Returns whether or not this module is compatible with the supplied
# module.

View File

@ -61,6 +61,7 @@ module Session
def initialize
self.alive = true
self.uuid = Rex::Text.rand_text_alpha(32)
end
# Direct descendents
@ -190,12 +191,12 @@ module Session
# exploit instance.
#
def set_from_exploit(m)
self.via = {
'Exploit' => m.fullname,
'Payload' => 'payload/' + m.datastore['PAYLOAD'].to_s
}
self.via = { 'Exploit' => m.fullname }
self.via['Payload'] = ('payload/' + m.datastore['PAYLOAD'].to_s) if m.datastore['PAYLOAD']
self.target_host = m.target_host
self.workspace = m.workspace
self.username = m.owner
self.exploit_datastore = m.datastore
self.user_input = m.user_input if m.user_input
self.user_output = m.user_output if m.user_output
@ -275,6 +276,14 @@ module Session
# The specific identified session info
#
attr_accessor :info
#
# The unique identifier of this session
#
attr_accessor :uuid
#
# The associated username
#
attr_accessor :username
protected
attr_accessor :via # :nodoc: