1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00

Fix use of Tempfile

git-svn-id: file:///home/svn/framework3/trunk@5246 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
HD Moore 2007-12-31 08:20:48 +00:00
parent 5131e4b747
commit d6e5b0a25d
3 changed files with 13 additions and 4 deletions

View File

@ -395,6 +395,8 @@ module Db
fd.close fd.close
File.unlink(x.path)
load_nmap_xml(data) load_nmap_xml(data)
end end

View File

@ -60,6 +60,7 @@ class Nasm
# Remove temporary files # Remove temporary files
File.unlink(opath) File.unlink(opath)
File.unlink(tpath)
tmp.close tmp.close
rv rv

View File

@ -107,12 +107,18 @@ class Plugin::DBSQLite3 < Msf::Plugin
return return
end end
IO.popen("#{sqlite3} \"#{opts['dbfile']}\" < \"#{sql}\"") do |io|
io.each_line do |line| tmp = Tempfile.new("sqlXXXXXXX")
print_line("OUTPUT: " + line.strip)
end system("#{sqlite3} \"#{opts['dbfile']}\" < \"#{sql}\" >\"#{tmp.path}\" 2>&1")
tmp.read.each_line do |line|
print_status("OUTPUT: #{line.strip}")
end end
tmp.close
File.unlink(tmp.path)
if (not framework.db.connect(opts)) if (not framework.db.connect(opts))
raise PluginLoadError.new("Failed to connect to the database") raise PluginLoadError.new("Failed to connect to the database")
end end