3370465d84
MSP-9606 In order to support Metasploit::Credential correctly, metasploit-framework needs to support Metasploit::Concern, which does all its magic using a Rails::Engine initializer, so the easiest path is to make metasploit-framework be able to use Rails::Engines. To make Rails::Engine use Rails::Engine, make a dummy Rails::Application subclass so that all the initializers will be run when anything requires msfenv.
34 lines
675 B
Ruby
34 lines
675 B
Ruby
require 'pathname'
|
|
require 'rubygems'
|
|
|
|
bundle_gemfile = ENV['BUNDLE_GEMFILE']
|
|
|
|
config_pathname = Pathname.new(__FILE__).expand_path.parent
|
|
root = config_pathname.parent
|
|
|
|
if bundle_gemfile
|
|
bundle_gemfile = Pathname.new(bundle_gemfile)
|
|
else
|
|
bundle_gemfile = root.join('Gemfile')
|
|
end
|
|
|
|
if bundle_gemfile.exist?
|
|
ENV['BUNDLE_GEMFILE'] = bundle_gemfile.to_path
|
|
|
|
begin
|
|
require 'bundler'
|
|
rescue LoadError
|
|
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed"
|
|
$stderr.puts " $ gem install bundler"
|
|
exit(0)
|
|
end
|
|
end
|
|
|
|
Bundler.setup
|
|
|
|
lib_path = root.join('lib').to_path
|
|
|
|
unless $LOAD_PATH.include? lib_path
|
|
$LOAD_PATH.unshift lib_path
|
|
end
|