Fixed dir download. Retry when no network even at the download start

bug/bundler_fix
caye 2016-07-12 23:05:50 +00:00
parent a6e92034bf
commit ed8fec255e
No known key found for this signature in database
GPG Key ID: 8449D21ECBABD316
2 changed files with 17 additions and 4 deletions

View File

@ -236,9 +236,9 @@ class Dir < Rex::Post::Dir
stat.call('dir downloading', src_item, dst_item) if (stat)
begin
if (continue || tries) # allow to file.download to log messages
result = client.fs.file.download(dst_item, src_item, continue, tries, tries_no, &stat)
result = client.fs.file.download_file(dst_item, src_item, continue, tries, tries_no, &stat)
else
result = client.fs.file.download(dst_item, src_item, continue, tries, tries_no)
result = client.fs.file.download_file(dst_item, src_item, continue, tries, tries_no)
end
stat.call(result, src_item, dst_item) if (stat)
rescue ::Rex::Post::Meterpreter::RequestError => e

View File

@ -399,7 +399,7 @@ class Console::CommandDispatcher::Stdapi::Fs
src_path = file['path'] + client.fs.file.separator + file['name']
dest_path = src_path.tr(src_separator, ::File::SEPARATOR)
client.fs.file.download(dest_path, src_path) do |step, src, dst|
client.fs.file.download(dest_path, src_path, continue, tries, tries_no) do |step, src, dst|
puts step
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
client.framework.events.on_session_download(client, src, dest) if msf_loaded?
@ -412,7 +412,20 @@ class Console::CommandDispatcher::Stdapi::Fs
else
# Perform direct matching
stat = client.fs.file.stat(src)
tries_cnt = 0
begin
stat = client.fs.file.stat(src)
rescue Rex::TimeoutError
if (tries && (tries_no == 0 || tries_cnt < tries_no))
tries_cnt += 1
print_error("Error opening: #{src} - retry (#{tries_cnt})")
retry
else
print_error("Error opening: #{src} - giving up")
raise
end
end
if (stat.directory?)
client.fs.dir.download(dest, src, recursive, true, glob, continue, tries, tries_no) do |step, src, dst|
print_status("#{step.ljust(11)}: #{src} -> #{dst}")