1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00

During a recursive download, ensure that the local directories are created properly

git-svn-id: file:///home/svn/framework3/trunk@7117 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
HD Moore 2009-10-02 14:57:25 +00:00
parent 9e19121858
commit 304ed6b0a6
2 changed files with 6 additions and 4 deletions

View File

@ -6,6 +6,7 @@ require 'rex/post/meterpreter/channels/pools/file'
require 'rex/post/meterpreter/extensions/stdapi/stdapi'
require 'rex/post/meterpreter/extensions/stdapi/fs/io'
require 'rex/post/meterpreter/extensions/stdapi/fs/file_stat'
require 'fileutils'
module Rex
module Post
@ -128,6 +129,7 @@ Separator = "\\"
#
def File.download_file(dest_file, src_file)
src_fd = client.fs.file.new(src_file, "rb")
::FileUtils.mkdir_p(::File.dirname(dest_file))
dst_fd = ::File.new(dest_file, "wb")
# Keep transferring until EOF is reached...

View File

@ -18,6 +18,10 @@ module Fs
###
class FileStat < Rex::Post::FileStat
class <<self
attr_accessor :client
end
@@struct_stat = [
'st_dev', 4, # 0
'st_ino', 2, # 4
@ -33,10 +37,6 @@ class FileStat < Rex::Post::FileStat
'st_ctime', 8, # 40
]
class <<self
attr_accessor :client
end
##
#
# Constructor