Land #5052, fix bug with session creation

Fix the bug that attempted to use a session before it was added to the
database.

MSP-12493 #land
This commit is contained in:
Matt Buck 2015-04-01 14:38:42 -05:00
commit cecc8aba2c
No known key found for this signature in database
GPG Key ID: 42134E0C9C4E94BB
1 changed files with 8 additions and 7 deletions

View File

@ -187,13 +187,6 @@ module Msf::DBManager::Session
via_payload: session.via_payload,
}
if session.exploit_task and session.exploit_task.record
session_task = session.exploit_task.record
if session_task.class == Mdm::Task
Mdm::TaskSession.create(task: session_task, session: s )
end
end
# In the case of multi handler we cannot yet determine the true
# exploit responsible. But we can at least show the parent versus
# just the generic handler:
@ -202,6 +195,14 @@ module Msf::DBManager::Session
end
s = ::Mdm::Session.create!(sess_data)
if session.exploit_task and session.exploit_task.record
session_task = session.exploit_task.record
if session_task.class == Mdm::Task
Mdm::TaskSession.create(task: session_task, session: s )
end
end
s
}
end