Safer connection store file reading by handling the case where user does not have permissions to read the file.

This commit is contained in:
Quentin Kaiser
2020-11-25 12:33:28 +01:00
parent 26a3342a3d
commit debaa44733
@@ -108,8 +108,10 @@ class MetasploitModule < Msf::Post
if !session.fs.file.exist?(path)
next
end
connstore_file = session.fs.file.open(path) rescue nil
next if connstore_file.nil?
connstore_data = session.fs.file.open(path).read.to_s
connstore_data = connstore_file.read.to_s
matches = connstore_data.scan(/ive "([a-z0-9]*)" {.*?connection-source: "([^"]*)".*?friendly-name: "([^"]*)".*?uri: "([^"]*)".*?}/m)
matches.each do |m|
ives[m[0]] = {}