Skip to content

Commit bd2af01

Browse files
committed
properly handle when there is no stat callback specified on upload
1 parent 289277c commit bd2af01

File tree

1 file changed

+3
-3
lines changed
  • lib/rex/post/meterpreter/extensions/stdapi/fs

1 file changed

+3
-3
lines changed

lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def File.upload(destination, *src_files, &stat)
274274
def File.upload_file(dest_file, src_file, &stat)
275275
# Open the file on the remote side for writing and read
276276
# all of the contents of the local file
277-
stat.call('uploading', src_file, dest_file) if (stat)
277+
stat.call('uploading', src_file, dest_file) if stat
278278
dest_fd = nil
279279
src_fd = nil
280280
buf_size = 8 * 1024 * 1024
@@ -288,13 +288,13 @@ def File.upload_file(dest_file, src_file, &stat)
288288
percent = dest_fd.pos.to_f / src_size.to_f * 100.0
289289
msg = "Uploaded #{Filesize.new(dest_fd.pos).pretty} of " \
290290
"#{Filesize.new(src_size).pretty} (#{percent.round(2)}%)"
291-
stat.call(msg, src_file, dest_file)
291+
stat.call(msg, src_file, dest_file) if stat
292292
end
293293
ensure
294294
src_fd.close unless src_fd.nil?
295295
dest_fd.close unless dest_fd.nil?
296296
end
297-
stat.call('uploaded', src_file, dest_file) if (stat)
297+
stat.call('uploaded', src_file, dest_file) if stat
298298
end
299299

300300
def File.is_glob?(name)

0 commit comments

Comments
 (0)