Skip to content

Commit c447553

Browse files
David MaloneyDavid Maloney
authored andcommitted
Report on TaskSession associations
add TaskSession objects so when we report on a session, we know what Task created it, if there was a task
1 parent e70221a commit c447553

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ group :db do
1515
# Needed for Msf::DbManager
1616
gem 'activerecord'
1717
# Database models shared between framework and Pro.
18-
gem 'metasploit_data_models', '~> 0.15.2'
18+
gem 'metasploit_data_models', '~> 0.16.1'
1919
# Needed for module caching in Mdm::ModuleDetails
2020
gem 'pg', '>= 0.11'
2121
end

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GEM
2323
i18n (0.6.1)
2424
json (1.7.7)
2525
metaclass (0.0.1)
26-
metasploit_data_models (0.15.2)
26+
metasploit_data_models (0.16.1)
2727
activerecord (>= 3.2.13)
2828
activesupport
2929
pg
@@ -65,7 +65,7 @@ DEPENDENCIES
6565
database_cleaner
6666
factory_girl (>= 4.1.0)
6767
json
68-
metasploit_data_models (~> 0.15.2)
68+
metasploit_data_models (~> 0.16.1)
6969
msgpack
7070
nokogiri
7171
pcaprub

lib/msf/core/db.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,14 @@ def report_session(opts)
786786
s = ::Mdm::Session.new(sess_data)
787787
s.save!
788788

789+
if session.exploit_task and session.exploit_task.record
790+
session_task = session.exploit_task.record
791+
if session_task.class == Mdm::Task
792+
Mdm::TaskSession.create(:task => session_task, :session => s )
793+
end
794+
end
795+
796+
789797
if opts[:session]
790798
session.db_record = s
791799
end

lib/msf/core/session.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ def set_from_exploit(m)
270270
self.user_output = m.user_output if m.user_output
271271
self.exploit_uuid = m.uuid
272272
self.exploit = m
273+
if m[:task]
274+
self.exploit_task = m[:task]
275+
end
273276
end
274277

275278
#
@@ -365,6 +368,10 @@ def alive?
365368
# The datastore of the exploit that created this session
366369
#
367370
attr_accessor :exploit_datastore
371+
#
372+
# The task that ran the exploit that got the session (that swallowed the fly)
373+
#
374+
attr_accessor :exploit_task
368375
#
369376
# The specific identified session info
370377
#

0 commit comments

Comments
 (0)