From f482995f749da74c07c82d678290b9394fc23c9b Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Mon, 14 May 2018 17:39:40 -0400 Subject: [PATCH] Minor changes to be similar to other servlets --- .../http/servlet/session_servlet.rb | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/msf/core/db_manager/http/servlet/session_servlet.rb b/lib/msf/core/db_manager/http/servlet/session_servlet.rb index d2a288c7a3..c1d1b8dbeb 100644 --- a/lib/msf/core/db_manager/http/servlet/session_servlet.rb +++ b/lib/msf/core/db_manager/http/servlet/session_servlet.rb @@ -4,8 +4,8 @@ module SessionServlet end def self.registered(app) - app.post SessionServlet.api_path, &report_session app.get SessionServlet.api_path, &get_session + app.post SessionServlet.api_path, &report_session end ####### @@ -16,7 +16,7 @@ module SessionServlet lambda { begin #opts = parse_json_request(request, false) - data = get_db().get_all_sessions() + data = get_db.get_all_sessions() set_json_response(data) rescue => e set_error_on_response(e) @@ -26,14 +26,18 @@ module SessionServlet def self.report_session lambda { - job = lambda { |opts| - if (opts[:session_data]) - get_db().report_session_dto(opts) - else - get_db().report_session_host_dto(opts) - end - } - exec_report_job(request, &job) + begin + job = lambda { |opts| + if opts[:session_data] + get_db.report_session_dto(opts) + else + get_db.report_session_host_dto(opts) + end + } + exec_report_job(request, &job) + rescue => e + set_error_on_response(e) + end } end end \ No newline at end of file