Minor changes to be similar to other servlets

GSoC/Meterpreter_Web_Console
Matthew Kienow 2018-05-14 17:39:40 -04:00
parent b3a1f2531b
commit f482995f74
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
1 changed files with 14 additions and 10 deletions

View File

@ -4,8 +4,8 @@ module SessionServlet
end end
def self.registered(app) def self.registered(app)
app.post SessionServlet.api_path, &report_session
app.get SessionServlet.api_path, &get_session app.get SessionServlet.api_path, &get_session
app.post SessionServlet.api_path, &report_session
end end
####### #######
@ -16,7 +16,7 @@ module SessionServlet
lambda { lambda {
begin begin
#opts = parse_json_request(request, false) #opts = parse_json_request(request, false)
data = get_db().get_all_sessions() data = get_db.get_all_sessions()
set_json_response(data) set_json_response(data)
rescue => e rescue => e
set_error_on_response(e) set_error_on_response(e)
@ -26,14 +26,18 @@ module SessionServlet
def self.report_session def self.report_session
lambda { lambda {
job = lambda { |opts| begin
if (opts[:session_data]) job = lambda { |opts|
get_db().report_session_dto(opts) if opts[:session_data]
else get_db.report_session_dto(opts)
get_db().report_session_host_dto(opts) else
end get_db.report_session_host_dto(opts)
} end
exec_report_job(request, &job) }
exec_report_job(request, &job)
rescue => e
set_error_on_response(e)
end
} }
end end
end end