代码拉取完成,页面将自动刷新
# msf-json-rpc.ru
# Start using thin:
# thin --rackup msf-json-rpc.ru --address localhost --port 8081 --environment development --tag msf-json-rpc start
#
require 'pathname'
@framework_path = File.expand_path(File.dirname(__FILE__))
root = Pathname.new(@framework_path).expand_path
@framework_lib_path = root.join('lib')
$LOAD_PATH << @framework_lib_path unless $LOAD_PATH.include?(@framework_lib_path)
require 'msfenv'
if ENV['MSF_LOCAL_LIB']
$LOAD_PATH << ENV['MSF_LOCAL_LIB'] unless $LOAD_PATH.include?(ENV['MSF_LOCAL_LIB'])
end
run Msf::WebServices::JsonRpcApp
#
# Ensure that framework is loaded before any external requests can be routed to the running
# application. This stops the possibility of the rack application being alive, but all
# requests failing.
#
warmup do |app|
client = Rack::MockRequest.new(app)
response = client.get('/api/v1/health')
warmup_error_message = "Metasploit JSON RPC did not successfully start up. Unexpected response returned: '#{response.body}'"
begin
parsed_response = JSON.parse(response.body)
rescue JSON::ParserError => e
raise warmup_error_message, e
end
expected_response = { 'data' => { 'status' => 'UP' } }
is_valid_response = parsed_response == expected_response
unless is_valid_response
raise warmup_error_message
end
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。