More tempfile nonsense

git-svn-id: file:///home/svn/framework3/trunk@5247 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2007-12-31 08:27:24 +00:00
parent d6e5b0a25d
commit 5e2f1ea7cc
2 changed files with 6 additions and 6 deletions

View File

@ -379,6 +379,8 @@ module Db
end end
fd = Tempfile.new('dbnmap') fd = Tempfile.new('dbnmap')
fd.close
args.push('-oX', fd.path) args.push('-oX', fd.path)
args.unshift(nmap) args.unshift(nmap)
@ -391,11 +393,9 @@ module Db
end end
end end
data = fd.read data = File.read(fd.path)
fd.close File.unlink(fd.path)
File.unlink(x.path)
load_nmap_xml(data) load_nmap_xml(data)
end end

View File

@ -109,14 +109,14 @@ class Plugin::DBSQLite3 < Msf::Plugin
tmp = Tempfile.new("sqlXXXXXXX") tmp = Tempfile.new("sqlXXXXXXX")
tmp.close
system("#{sqlite3} \"#{opts['dbfile']}\" < \"#{sql}\" >\"#{tmp.path}\" 2>&1") system("#{sqlite3} \"#{opts['dbfile']}\" < \"#{sql}\" >\"#{tmp.path}\" 2>&1")
tmp.read.each_line do |line| File.read(tmp.path).each_line do |line|
print_status("OUTPUT: #{line.strip}") print_status("OUTPUT: #{line.strip}")
end end
tmp.close
File.unlink(tmp.path) File.unlink(tmp.path)
if (not framework.db.connect(opts)) if (not framework.db.connect(opts))