Add load_resource exception for msfconsole.rc
This prevents msfconsole from erroring on a nonexistent msfconsole.rc.bug/bundler_fix
parent
8cec8e68ac
commit
259e95ed21
|
@ -243,16 +243,16 @@ class Core
|
|||
|
||||
args.each do |res|
|
||||
good_res = nil
|
||||
if (File.file? res and File.readable? res)
|
||||
if ::File.exists?(res)
|
||||
good_res = res
|
||||
elsif
|
||||
# let's check to see if it's in the scripts/resource dir (like when tab completed)
|
||||
[
|
||||
::Msf::Config.script_directory + File::SEPARATOR + "resource",
|
||||
::Msf::Config.user_script_directory + File::SEPARATOR + "resource"
|
||||
::Msf::Config.script_directory + ::File::SEPARATOR + "resource",
|
||||
::Msf::Config.user_script_directory + ::File::SEPARATOR + "resource"
|
||||
].each do |dir|
|
||||
res_path = dir + File::SEPARATOR + res
|
||||
if (File.file?(res_path) and File.readable?(res_path))
|
||||
res_path = dir + ::File::SEPARATOR + res
|
||||
if ::File.exists?(res_path)
|
||||
good_res = res_path
|
||||
break
|
||||
end
|
||||
|
|
|
@ -235,7 +235,8 @@ class Driver < Msf::Ui::Driver
|
|||
# Process any resource scripts
|
||||
if opts['Resource'].blank?
|
||||
# None given, load the default
|
||||
load_resource(File.join(Msf::Config.config_directory, 'msfconsole.rc'))
|
||||
default_resource = ::File.join(Msf::Config.config_directory, 'msfconsole.rc')
|
||||
load_resource(default_resource) if ::File.exists?(default_resource)
|
||||
else
|
||||
opts['Resource'].each { |r|
|
||||
load_resource(r)
|
||||
|
@ -420,7 +421,7 @@ class Driver < Msf::Ui::Driver
|
|||
if path == '-'
|
||||
resource_file = $stdin.read
|
||||
path = 'stdin'
|
||||
elsif ::File.readable?(path)
|
||||
elsif ::File.exists?(path)
|
||||
resource_file = ::File.read(path)
|
||||
else
|
||||
print_error("Cannot find resource script: #{path}")
|
||||
|
|
Loading…
Reference in New Issue