Lands #4970, fixes exception about msfconsole.rc

bug/bundler_fix
HD Moore 2015-03-20 16:49:04 -05:00
commit 1eafb21741
No known key found for this signature in database
GPG Key ID: 7549FB3DB1DD1F32
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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}")