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.
21 lines
652 B
Ruby
21 lines
652 B
Ruby
# Top-level namespace that is shared between {Metasploit::Framework
|
|
# metasploit-framework} and pro, which uses Metasploit::Pro.
|
|
module Metasploit
|
|
# Supports Rails and Rails::Engine like access to metasploit-framework so it
|
|
# works in compatible manner with activerecord's rake tasks and other
|
|
# railties.
|
|
module Framework
|
|
# Returns the root of the metasploit-framework project. Use in place of
|
|
# `Rails.root`.
|
|
#
|
|
# @return [Pathname]
|
|
def self.root
|
|
unless instance_variable_defined? :@root
|
|
pathname = Pathname.new(__FILE__)
|
|
@root = pathname.parent.parent.parent
|
|
end
|
|
|
|
@root
|
|
end
|
|
end
|
|
end |