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:
parent
9e19121858
commit
304ed6b0a6
@ -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...
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user