commit
59eec8f81e
|
@ -246,9 +246,10 @@ class File < Rex::Post::Meterpreter::Extensions::Stdapi::Fs::IO
|
|||
#
|
||||
# Upload a single file.
|
||||
#
|
||||
def File.upload_file(dest_file, src_file)
|
||||
def File.upload_file(dest_file, src_file, &stat)
|
||||
# Open the file on the remote side for writing and read
|
||||
# all of the contents of the local file
|
||||
stat.call('uploading', src_file, dest_file) if (stat)
|
||||
dest_fd = client.fs.file.new(dest_file, "wb")
|
||||
src_buf = ''
|
||||
|
||||
|
@ -261,6 +262,7 @@ class File < Rex::Post::Meterpreter::Extensions::Stdapi::Fs::IO
|
|||
ensure
|
||||
dest_fd.close
|
||||
end
|
||||
stat.call('uploaded', src_file, dest_file) if (stat)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -503,10 +503,17 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|||
client.framework.events.on_session_upload(client, src, dest) if msf_loaded?
|
||||
}
|
||||
elsif (stat.file?)
|
||||
if client.fs.file.exists?(dest) and client.fs.file.stat(dest).directory?
|
||||
client.fs.file.upload(dest, src) { |step, src, dst|
|
||||
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
|
||||
client.framework.events.on_session_upload(client, src, dest) if msf_loaded?
|
||||
}
|
||||
else
|
||||
client.fs.file.upload_file(dest, src) { |step, src, dst|
|
||||
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
|
||||
client.framework.events.on_session_upload(client, src, dest) if msf_loaded?
|
||||
}
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue