Fix report_session_event with remote data service
Modify DBManager method to allow session ID retrieval from a HashGSoC/Meterpreter_Web_Console
parent
111536bf49
commit
2c92e85494
|
@ -17,7 +17,7 @@ module SessionEventServlet
|
||||||
lambda {
|
lambda {
|
||||||
begin
|
begin
|
||||||
opts = parse_json_request(request, false)
|
opts = parse_json_request(request, false)
|
||||||
data = get_db().session_events(opts)
|
data = get_db.session_events(opts)
|
||||||
set_json_response(data)
|
set_json_response(data)
|
||||||
rescue => e
|
rescue => e
|
||||||
set_error_on_response(e)
|
set_error_on_response(e)
|
||||||
|
@ -27,10 +27,14 @@ module SessionEventServlet
|
||||||
|
|
||||||
def self.report_session_event
|
def self.report_session_event
|
||||||
lambda {
|
lambda {
|
||||||
job = lambda { |opts|
|
begin
|
||||||
opts[:session] = open_struct(opts[:session][:table])
|
job = lambda { |opts|
|
||||||
get_db().report_session_event(opts) }
|
get_db.report_session_event(opts)
|
||||||
exec_report_job(request, &job)
|
}
|
||||||
|
exec_report_job(request, &job)
|
||||||
|
rescue => e
|
||||||
|
set_error_on_response(e)
|
||||||
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -11,7 +11,7 @@ module Msf::DBManager::SessionEvent
|
||||||
# Record a session event in the database
|
# Record a session event in the database
|
||||||
#
|
#
|
||||||
# opts MUST contain one of:
|
# opts MUST contain one of:
|
||||||
# +:session+:: the Msf::Session OR the ::Mdm::Session we are reporting
|
# +:session+:: the Msf::Session, Mdm::Session or Hash representation of Mdm::Session we are reporting
|
||||||
# +:etype+:: event type, enum: command, output, upload, download, filedelete
|
# +:etype+:: event type, enum: command, output, upload, download, filedelete
|
||||||
#
|
#
|
||||||
# opts may contain
|
# opts may contain
|
||||||
|
@ -46,7 +46,14 @@ module Msf::DBManager::SessionEvent
|
||||||
event_data = { :created_at => opts[:created_at] }
|
event_data = { :created_at => opts[:created_at] }
|
||||||
end
|
end
|
||||||
|
|
||||||
event_data[:session_id] = session.id
|
session_id = nil
|
||||||
|
if session.kind_of?(Mdm::Session)
|
||||||
|
session_id = session.id
|
||||||
|
elsif session.is_a?(Hash) && session.key?(:id)
|
||||||
|
session_id = session[:id]
|
||||||
|
end
|
||||||
|
|
||||||
|
event_data[:session_id] = session_id
|
||||||
[:remote_path, :local_path, :output, :command, :etype].each do |attr|
|
[:remote_path, :local_path, :output, :command, :etype].each do |attr|
|
||||||
event_data[attr] = opts[attr] if opts[attr]
|
event_data[attr] = opts[attr] if opts[attr]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue