Class: Msf::RPC::Health
- Inherits:
-
Object
- Object
- Msf::RPC::Health
- Defined in:
- lib/msf/core/rpc/v10/health.rb
Class Method Summary collapse
-
.check(framework) ⇒ Hash
Returns whether the framework object is currently healthy and ready to accept requests.
Class Method Details
.check(framework) ⇒ Hash
Returns whether the framework object is currently healthy and ready to accept requests
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/msf/core/rpc/v10/health.rb', line 11 def self.check(framework) # A couple of rudimentary checks to ensure that nothing breaks when interacting # with framework object is_healthy = ( !framework.version.to_s.empty? && # Ensure that the db method can be invoked and returns a truthy value as # the rpc clients interact with framework's database object which raises can # raise an exception framework.db ) unless is_healthy return { status: 'DOWN' } end { status: 'UP' } rescue => e elog('Health status failing', error: e) { status: 'DOWN' } end |