Module: Msf::WebServices::HealthServlet

Defined in:
lib/msf/core/web_services/servlet/health_servlet.rb

Class Method Summary collapse

Class Method Details

.api_path ⇒ Object



3
4
5
# File 'lib/msf/core/web_services/servlet/health_servlet.rb', line 3

def self.api_path
  '/api/v1/health'
end

.health_check ⇒ Object



15
16
17
18
19
20
21
# File 'lib/msf/core/web_services/servlet/health_servlet.rb', line 15

def self.health_check
  lambda {
    health_check = Msf::RPC::Health.check(framework)
    is_success = health_check[:status] == 'UP'
    set_json_data_response(response: health_check, code: is_success ? 200 : 503)
  }
end

.registered(app) ⇒ Object



7
8
9
# File 'lib/msf/core/web_services/servlet/health_servlet.rb', line 7

def self.registered(app)
  app.get self.api_path, &health_check
end