Force binmode for Tempfile use to prevent issues with Windows

git-svn-id: file:///home/svn/framework3/trunk@10650 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-10-12 01:48:42 +00:00
parent 2d425d2e67
commit 0b82de4846
5 changed files with 10 additions and 0 deletions

View File

@ -1271,7 +1271,10 @@ class Db
end
fd = Tempfile.new('dbnmap')
fd.binmode
fo = Tempfile.new('dbnmap')
fo.binmode
# When executing native Nmap in Cygwin, expand the Cygwin path to a Win32 path
if(Rex::Compat.is_cygwin and nmap =~ /cygdrive/)

View File

@ -23,6 +23,7 @@ class Key
format = args[:format]
if data
fd = Tempfile.new("msf3-sshkey-temp-")
fd.binmode
fd.write data
fd.flush
file = fd.path

View File

@ -42,6 +42,8 @@ class Nasm
# Open the temporary file
tmp = Tempfile.new('nasmXXXX')
tmp.binmode
tpath = tmp.path
opath = tmp.path + '.out'
@ -72,6 +74,8 @@ class Nasm
check
tmp = Tempfile.new('nasmout')
tmp.binmode
tfd = File.open(tmp.path, "wb")
tfd.write(raw)

View File

@ -231,6 +231,7 @@ def self.temp_copy(path)
raise RuntimeError,"missing Tempfile" if not @@loaded_tempfile
fd = File.open(path, "rb")
tp = Tempfile.new("msftemp")
tp.binmode
tp.write(fd.read(File.size(path)))
tp.close
fd.close

View File

@ -248,6 +248,7 @@ class Console::CommandDispatcher::Stdapi::Fs
# Get a temporary file path
meterp_temp = Tempfile.new('meterp')
meterp_temp.binmode
temp_path = meterp_temp.path
begin