ensure that module counts are reflected accurately, and add option to specify a module path to msfconsole, fixes #25

git-svn-id: file:///home/svn/framework3/trunk@4462 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2007-02-24 05:29:05 +00:00
parent 3a8b138e74
commit 58708378d1
3 changed files with 18 additions and 1 deletions

View File

@ -610,7 +610,17 @@ class ModuleManager < ModuleSet
# We only do this if the caller wanted us to check the cache in the # We only do this if the caller wanted us to check the cache in the
# first place. By default, check_cache will be true. One scenario # first place. By default, check_cache will be true. One scenario
# where it will be false is from the loadpath command in msfconsole. # where it will be false is from the loadpath command in msfconsole.
save_module_cache if (!using_cache and check_cache) if !using_cache and check_cache
save_module_cache
# If we're by default using the cache and we were told not to
# invalidate/use it, then we should update the cached counts to include
# what we've just added so that the banner will reflect the changes
# correctly.
elsif using_cache and !check_cache
cached_counts.each_key { |k|
cached_counts[k] += counts[k] if counts[k]
}
end
return counts return counts
end end

View File

@ -87,6 +87,9 @@ class Driver < Msf::Ui::Driver
# Re-enable output # Re-enable output
self.disable_output = false self.disable_output = false
# Load additional modules as necessary
self.framework.modules.add_module_path(opts['ModulePath'], false) if opts['ModulePath']
# Process things before we actually display the prompt and get rocking # Process things before we actually display the prompt and get rocking
on_startup on_startup

View File

@ -43,6 +43,10 @@ class OptsConsole
options['Config'] = c options['Config'] = c
end end
opts.on("-m", "-m <directory>", "Specifies an additional module search path") do |m|
options['ModulePath'] = m
end
# Boolean switch. # Boolean switch.
opts.on("-v", "--version", "Show version") do |v| opts.on("-v", "--version", "Show version") do |v|
options['Version'] = true options['Version'] = true