Module: Msf::Simple::Framework::ModulePaths
- Included in:
- Msf::Simple::Framework
- Defined in:
- lib/msf/base/simple/framework/module_paths.rb
Instance Method Summary collapse
-
#init_module_paths(opts = {}) ⇒ void
Initialize the module paths.
Instance Method Details
#init_module_paths(opts = {}) ⇒ void
This method returns an undefined value.
Initialize the module paths
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/msf/base/simple/framework/module_paths.rb', line 10 def init_module_paths(opts={}) if @module_paths_inited fail "Module paths already initialized. To add more module paths call `modules.add_module_path`" return end allowed_module_paths = [] extract_engine_module_paths(Rails.application).each do |path| allowed_module_paths << path end if Msf::Config.user_module_directory allowed_module_paths << Msf::Config.user_module_directory end ::Rails::Engine.subclasses.map(&:instance).each do |engine| extract_engine_module_paths(engine).each do |path| allowed_module_paths << path end end # If additional module paths have been defined globally, then load them. # They should be separated by semi-colons. self.datastore['MsfModulePaths'].to_s.split(";").each do |path| allowed_module_paths << path end # If the caller had additional paths to search, load them. # They should be separated by semi-colons. opts.delete(:module_paths).to_s.split(";").each do |path| allowed_module_paths << path end # Remove any duplicate paths allowed_module_paths.uniq! # Update the module cache from the database self.modules.refresh_cache_from_database(allowed_module_paths) # Load each of the module paths allowed_module_paths.each do |path| self.modules.add_module_path(path, opts, recalculate: false) end @module_paths_inited = true end |