Module: Msf::ModuleManager::Reloading
- Included in:
- Msf::ModuleManager
- Defined in:
- lib/msf/core/module_manager/reloading.rb
Overview
Concerns reloading modules
Instance Method Summary collapse
-
#reload_module(mod) ⇒ Class, Msf::Module
Reloads the module specified in mod.
-
#reload_modules ⇒ Hash{String => Integer}
Reloads modules from all module paths.
Instance Method Details
#reload_module(mod) ⇒ Class, Msf::Module
Reloads the module specified in mod. This can either be an instance of a module or a module class.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/msf/core/module_manager/reloading.rb', line 8 def reload_module(mod) # if it's can instance, then get its class if mod.is_a? Msf::Module = mod.class else = mod end if aliased_as = self.inv_aliases[.fullname] aliased_as.each do |a| self.aliases.delete a end self.inv_aliases.delete .fullname end namespace_module = .module_parent loader = namespace_module.loader loader.reload_module(mod) end |
#reload_modules ⇒ Hash{String => Integer}
Reloads modules from all module paths
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 56 |
# File 'lib/msf/core/module_manager/reloading.rb', line 31 def reload_modules self.enablement_by_type.each_key do |type| module_set_by_type[type].clear init_module_set(type) end self.aliases.clear self.inv_aliases.clear # default the count to zero the first time a type is accessed count_by_type = Hash.new(0) framework.init_module_paths unless framework.module_paths_inited module_paths.each do |path| path_count_by_type = load_modules(path, force: true) # merge count with count from other paths path_count_by_type.each do |type, count| count_by_type[type] += count end end refresh_cache_from_module_files count_by_type end |