Files
metasploit-gs/lib/msf/core/module_manager/reloading.rb
T

47 lines
1.3 KiB
Ruby
Raw Normal View History

# -*- coding: binary -*-
2012-10-01 13:09:30 -05:00
# Concerns reloading modules
module Msf::ModuleManager::Reloading
# Reloads the module specified in mod. This can either be an instance of a module or a module class.
#
# @param [Msf::Module, Class] mod either an instance of a module or a module class
# @return (see Msf::Modules::Loader::Base#reload_module)
2012-10-01 13:09:30 -05:00
def reload_module(mod)
# if it's can instance, then get its class
if mod.is_a? Msf::Module
metasploit_class = mod.class
else
metasploit_class = mod
end
namespace_module = metasploit_class.parent
loader = namespace_module.loader
loader.reload_module(mod)
end
# Reloads modules from all module paths
#
# @return (see Msf::ModuleManager::Loading#load_modules)
2012-10-01 13:09:30 -05:00
def reload_modules
self.enablement_by_type.each_key do |type|
module_set_by_type[type].clear
init_module_set(type)
end
# default the count to zero the first time a type is accessed
count_by_type = Hash.new(0)
2012-10-01 13:09:30 -05:00
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
2012-10-01 13:09:30 -05:00
end
2012-10-04 11:14:08 -05:00
refresh_cache_from_module_files
2012-10-01 13:09:30 -05:00
count_by_type
2012-10-01 13:09:30 -05:00
end
end