Land 3694, msfconsole.rc wasn't loading, add yard

bug/bundler_fix
Joshua Smith 2014-08-26 01:12:33 -05:00
commit b3e898736f
No known key found for this signature in database
GPG Key ID: ADDEAD3D3D609E33
1 changed files with 24 additions and 30 deletions

View File

@ -15,12 +15,9 @@ module Msf
module Ui module Ui
module Console module Console
###
# #
# This class implements a user interface driver on a console interface. # A user interface driver on a console interface.
# #
###
class Driver < Msf::Ui::Driver class Driver < Msf::Ui::Driver
ConfigCore = "framework/core" ConfigCore = "framework/core"
@ -44,21 +41,18 @@ class Driver < Msf::Ui::Driver
# prompt character. The optional hash can take extra values that will # prompt character. The optional hash can take extra values that will
# serve to initialize the console driver. # serve to initialize the console driver.
# #
# The optional hash values can include: # @option opts [Boolean] 'AllowCommandPassthru' (true) Whether to allow
# # unrecognized commands to be executed by the system shell
# AllowCommandPassthru # @option opts [Boolean] 'RealReadline' (false) Whether to use the system's
# # readline library instead of RBReadline
# Whether or not unknown commands should be passed through and executed by # @option opts [String] 'HistFile' (Msf::Config.history_file) Path to a file
# the local system. # where we can store command history
# # @option opts [Array<String>] 'Resources' ([]) A list of resource files to
# RealReadline # load. If no resources are given, will load the default resource script,
# # 'msfconsole.rc' in the user's {Msf::Config.config_directory config
# Whether or to use the system Readline or the RBReadline (default) # directory}
# # @option opts [Boolean] 'SkipDatabaseInit' (false) Whether to skip
# HistFile # connecting to the database and running migrations
#
# Name of a file to store command history
#
def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {}) def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {})
# Choose a readline library before calling the parent # Choose a readline library before calling the parent
@ -253,14 +247,14 @@ class Driver < Msf::Ui::Driver
# Process things before we actually display the prompt and get rocking # Process things before we actually display the prompt and get rocking
on_startup(opts) on_startup(opts)
# Process the resource script # Process any resource scripts
if opts['Resource'] and opts['Resource'].kind_of? Array if opts['Resource'].empty?
# None given, load the default
load_resource(File.join(Msf::Config.config_directory, 'msfconsole.rc'))
else
opts['Resource'].each { |r| opts['Resource'].each { |r|
load_resource(r) load_resource(r)
} }
else
# If the opt is nil here, we load ~/.msf3/msfconsole.rc
load_resource(opts['Resource'])
end end
# Process any additional startup commands # Process any additional startup commands
@ -433,11 +427,11 @@ class Driver < Msf::Ui::Driver
end end
end end
# Processes a resource script file for the console.
# #
# Processes the resource script file for the console. # @param path [String] Path to a resource file to run
# # @return [void]
def load_resource(path=nil) def load_resource(path)
path ||= File.join(Msf::Config.config_directory, 'msfconsole.rc')
return if not ::File.readable?(path) return if not ::File.readable?(path)
resource_file = ::File.read(path) resource_file = ::File.read(path)
@ -605,9 +599,9 @@ class Driver < Msf::Ui::Driver
# The framework instance associated with this driver. # The framework instance associated with this driver.
# #
attr_reader :framework attr_reader :framework
# #
# Whether or not to confirm before exiting # Whether or not to confirm before exiting
# #
attr_reader :confirm_exit attr_reader :confirm_exit
# #
# Whether or not commands can be passed through. # Whether or not commands can be passed through.