move the client accessor back to the top so it's available when needed, use the session-specific separator, fixes #4892 again

git-svn-id: file:///home/svn/framework3/trunk@13350 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2011-07-26 22:37:41 +00:00
parent 3fe4c2524c
commit fa4dbf6783
2 changed files with 8 additions and 5 deletions

View File

@ -196,7 +196,7 @@ class Dir < Rex::Post::Dir
self.entries(src).each { |src_sub|
dst_item = dst + ::File::SEPARATOR + client.unicode_filter_encode( src_sub )
src_item = src + File::SEPARATOR + client.unicode_filter_encode( src_sub )
src_item = src + client.fs.file.separator + client.unicode_filter_encode( src_sub )
if (src_sub == '.' or src_sub == '..')
next
@ -240,7 +240,7 @@ class Dir < Rex::Post::Dir
#
def Dir.upload(dst, src, recursive = false, &stat)
::Dir.entries(src).each { |src_sub|
dst_item = dst + File::SEPARATOR + client.unicode_filter_encode( src_sub )
dst_item = dst + client.fs.file.separator + client.unicode_filter_encode( src_sub )
src_item = src + ::File::SEPARATOR + client.unicode_filter_encode( src_sub )
if (src_sub == '.' or src_sub == '..')

View File

@ -25,6 +25,10 @@ class File < Rex::Post::Meterpreter::Extensions::Stdapi::Fs::IO
include Rex::Post::File
class << self
attr_accessor :client
end
#
# Return the directory separator, i.e.: "/" on unix, "\\" on windows
#
@ -49,7 +53,6 @@ class File < Rex::Post::Meterpreter::Extensions::Stdapi::Fs::IO
end
class << self
attr_accessor :client
alias :Separator :separator
alias :SEPARATOR :separator
end
@ -187,8 +190,8 @@ class File < Rex::Post::Meterpreter::Extensions::Stdapi::Fs::IO
dest = destination
stat.call('uploading', src, dest) if (stat)
if (File.basename(destination) != ::File.basename(src))
dest += File.separator + ::File.basename(src)
if (self.basename(destination) != ::File.basename(src))
dest += self.separator + ::File.basename(src)
end
upload_file(dest, src)