From 5e2f1ea7cc8f9225ad8ec2b8ed191f78450cc89b Mon Sep 17 00:00:00 2001 From: HD Moore Date: Mon, 31 Dec 2007 08:27:24 +0000 Subject: [PATCH] More tempfile nonsense git-svn-id: file:///home/svn/framework3/trunk@5247 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/ui/console/command_dispatcher/db.rb | 8 ++++---- plugins/db_sqlite3.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index f2fc7a6a7f..291100d974 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -379,6 +379,8 @@ module Db end fd = Tempfile.new('dbnmap') + fd.close + args.push('-oX', fd.path) args.unshift(nmap) @@ -391,11 +393,9 @@ module Db end end - data = fd.read + data = File.read(fd.path) - fd.close - - File.unlink(x.path) + File.unlink(fd.path) load_nmap_xml(data) end diff --git a/plugins/db_sqlite3.rb b/plugins/db_sqlite3.rb index d018773dbe..f8430f2933 100644 --- a/plugins/db_sqlite3.rb +++ b/plugins/db_sqlite3.rb @@ -109,14 +109,14 @@ class Plugin::DBSQLite3 < Msf::Plugin tmp = Tempfile.new("sqlXXXXXXX") + tmp.close 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}") end - tmp.close File.unlink(tmp.path) if (not framework.db.connect(opts))