This patch adds a 'reload_all' command to msfconsole. This will flush and reload all modules from all module paths
git-svn-id: file:///home/svn/framework3/trunk@12040 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
2e267bdca3
commit
3d59be3586
|
@ -157,8 +157,7 @@ class ModuleSet < Hash
|
||||||
# Forces all modules in this set to be loaded.
|
# Forces all modules in this set to be loaded.
|
||||||
#
|
#
|
||||||
def force_load_set
|
def force_load_set
|
||||||
each_module { |name, mod|
|
each_module { |name, mod| }
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :module_type
|
attr_reader :module_type
|
||||||
|
@ -650,6 +649,28 @@ class ModuleManager < ModuleSet
|
||||||
|
|
||||||
def register_type_extension(type, ext)
|
def register_type_extension(type, ext)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Reloads modules from all module paths
|
||||||
|
#
|
||||||
|
def reload_modules
|
||||||
|
invalidate_cache
|
||||||
|
|
||||||
|
self.module_history = {}
|
||||||
|
self.module_history_mtime = {}
|
||||||
|
self.clear
|
||||||
|
|
||||||
|
self.enabled_types.each_key do |type|
|
||||||
|
module_sets[type].clear
|
||||||
|
init_module_set(type)
|
||||||
|
end
|
||||||
|
|
||||||
|
module_paths.each do |path|
|
||||||
|
counts = load_modules(path, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
save_module_cache
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Reloads the module specified in mod. This can either be an instance of a
|
# Reloads the module specified in mod. This can either be an instance of a
|
||||||
|
@ -858,6 +879,7 @@ protected
|
||||||
#
|
#
|
||||||
def load_module_from_file(path, file, loaded, recalc, counts, demand = false)
|
def load_module_from_file(path, file, loaded, recalc, counts, demand = false)
|
||||||
|
|
||||||
|
|
||||||
# If the file on disk hasn't changed with what we have stored in the
|
# If the file on disk hasn't changed with what we have stored in the
|
||||||
# cache, then there's no sense in loading it
|
# cache, then there's no sense in loading it
|
||||||
if (!has_module_file_changed?(file))
|
if (!has_module_file_changed?(file))
|
||||||
|
@ -1001,6 +1023,7 @@ protected
|
||||||
# off to a special payload set. The payload set, in turn, will
|
# off to a special payload set. The payload set, in turn, will
|
||||||
# automatically create all the permutations after all the payload
|
# automatically create all the permutations after all the payload
|
||||||
# modules have been loaded.
|
# modules have been loaded.
|
||||||
|
|
||||||
if (type != MODULE_PAYLOAD)
|
if (type != MODULE_PAYLOAD)
|
||||||
# Add the module class to the list of modules and add it to the
|
# Add the module class to the list of modules and add it to the
|
||||||
# type separated set of module classes
|
# type separated set of module classes
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Core
|
||||||
|
|
||||||
# The list of data store elements that cannot be set when in defanged
|
# The list of data store elements that cannot be set when in defanged
|
||||||
# mode.
|
# mode.
|
||||||
DefangedProhibitedDataStoreElements = [ "ModulePaths" ]
|
DefangedProhibitedDataStoreElements = [ "MsfModulePaths" ]
|
||||||
|
|
||||||
# Returns the list of commands supported by this command dispatcher
|
# Returns the list of commands supported by this command dispatcher
|
||||||
def commands
|
def commands
|
||||||
|
@ -93,6 +93,7 @@ class Core
|
||||||
"quit" => "Exit the console",
|
"quit" => "Exit the console",
|
||||||
"resource" => "Run the commands stored in a file",
|
"resource" => "Run the commands stored in a file",
|
||||||
"makerc" => "Save commands entered since start to a file",
|
"makerc" => "Save commands entered since start to a file",
|
||||||
|
"reload_all" => "Reloads all modules from all defined module paths",
|
||||||
"route" => "Route traffic through a session",
|
"route" => "Route traffic through a session",
|
||||||
"save" => "Saves the active datastores",
|
"save" => "Saves the active datastores",
|
||||||
"search" => "Searches module names and descriptions",
|
"search" => "Searches module names and descriptions",
|
||||||
|
@ -143,6 +144,16 @@ class Core
|
||||||
driver.update_prompt
|
driver.update_prompt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Reload all module paths that we are aware of
|
||||||
|
#
|
||||||
|
def cmd_reload_all(*args)
|
||||||
|
print_status("Reloading modules from all module paths...")
|
||||||
|
framework.modules.reload_modules
|
||||||
|
cmd_banner()
|
||||||
|
end
|
||||||
|
|
||||||
def cmd_resource_tabs(str, words)
|
def cmd_resource_tabs(str, words)
|
||||||
return [] if words.length > 1
|
return [] if words.length > 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue