Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Read the file instead of downloading it

  • Loading branch information...
commit dbd52c5a1edfe1818a580d4d46aac0a9ca038e9c 1 parent 55b84ad
@egypt egypt authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 test/modules/post/test/meterpreter.rb
View
17 test/modules/post/test/meterpreter.rb
@@ -164,16 +164,19 @@ def test_fs
vprint_status("uploading")
session.fs.file.upload_file(remote, local)
vprint_status("done")
- res &&= session.fs.dir.entries.include?(remote)
+ res &&= session.fs.file.exists?(remote)
vprint_status("remote file exists? #{res.inspect}")
if res
- session.fs.file.download(remote, remote)
- res &&= ::File.file? remote
- downloaded_contents = ::File.read(remote)
+ fd = session.fs.file.new(remote, "rb")
+ uploaded_contents = fd.read
+ until (fd.eof?)
+ uploaded_contents << fd.read
+ end
+ fd.close
original_contents = ::File.read(local)
- res &&= !!(downloaded_contents == original_contents)
- ::File.unlink remote
+
+ res &&= !!(uploaded_contents == original_contents)
end
session.fs.file.rm(remote)
@@ -187,7 +190,7 @@ def test_fs
vprint_status("uploading")
session.fs.file.upload_file(remote, local)
vprint_status("done")
- res &&= session.fs.dir.entries.include?(remote)
+ res &&= session.fs.file.exists?(remote)
vprint_status("remote file exists? #{res.inspect}")
if res
Please sign in to comment.
Something went wrong with that request. Please try again.