From 591ef73f7d4bd67c42a0c2dd0edd1bf565d664bb Mon Sep 17 00:00:00 2001 From: HD Moore Date: Mon, 28 Nov 2011 22:24:27 -0600 Subject: [PATCH] Merge in updated module_manager that loads all .fastlibs --- lib/msf/core/module_manager.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/msf/core/module_manager.rb b/lib/msf/core/module_manager.rb index daa6abb933..a1b8f2895f 100644 --- a/lib/msf/core/module_manager.rb +++ b/lib/msf/core/module_manager.rb @@ -614,9 +614,11 @@ class ModuleManager < ModuleSet # their loading will not impact the module path. # def add_module_path(path, check_cache = true) + epaths = [] + if path =~ /\.fastlib$/ unless ::File.exist?(path) - raise RuntimeError, "The path supplied is not a valid directory.", caller + raise RuntimeError, "The path supplied does not exist", caller end else path.sub!(/#{File::SEPARATOR}$/, '') @@ -626,16 +628,25 @@ class ModuleManager < ModuleSet # Make sure the path is a valid directory before we try to rock the # house - unless (path.directory?) + unless path.directory? raise RuntimeError, "The path supplied is not a valid directory.", caller end # Now that we've confirmed it exists, get the full, cononical path path = path.realpath.to_s + + # Identify any fastlib archives inside of this path + Dir["#{path}/**/*.fastlib"].each do |fp| + epaths << fp + end end module_paths << path + epaths.each do |epath| + module_paths << epath + end + begin counts = load_modules(path, !check_cache) rescue ModuleCacheInvalidated