diff --git a/modules/auxiliary/scanner/ssh/ssh_identify_pubkeys.rb b/modules/auxiliary/scanner/ssh/ssh_identify_pubkeys.rb index 41a2227580..192bdd4454 100644 --- a/modules/auxiliary/scanner/ssh/ssh_identify_pubkeys.rb +++ b/modules/auxiliary/scanner/ssh/ssh_identify_pubkeys.rb @@ -90,12 +90,12 @@ class MetasploitModule < Msf::Auxiliary keyfile = datastore['SSH_KEYFILE_B64'].unpack("m*").first elsif file.kind_of? Array keyfile = '' - file.map { |f| ::File.expand_path(f) }.each do |dir_entry| + file.each do |dir_entry| next unless ::File.readable? dir_entry keyfile << ::File.open(dir_entry, "rb") {|f| f.read(f.stat.size)} end else - keyfile = ::File.open(::File.expand_path(file), "rb") {|f| f.read(f.stat.size)} + keyfile = ::File.open(file, "rb") {|f| f.read(f.stat.size)} end keys = [] this_key = []