Skip to content

Commit 7cf6918

Browse files
committed
Add a test for stdapi_fs_file_move
Also disables tests for sniffer, which is crashy.
1 parent 0671406 commit 7cf6918

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

test/modules/post/test/meterpreter.rb

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def initialize(info={})
1515
'Description' => %q{ This module will test meterpreter API methods },
1616
'License' => MSF_LICENSE,
1717
'Author' => [ 'egypt'],
18-
'Version' => '$Revision$',
1918
'Platform' => [ 'windows', 'linux', 'java' ],
2019
'SessionTypes' => [ 'meterpreter' ]
2120
))
@@ -241,6 +240,30 @@ def test_fs
241240
session.fs.file.rm(remote)
242241
res
243242
end
243+
if session.commands.include?("stdapi_fs_file_move")
244+
it "should move files" do
245+
res = true
246+
247+
# Make sure we don't have leftovers from a previous run
248+
session.fs.file.rm("meterpreter-test") rescue nil
249+
session.fs.file.rm("meterpreter-test-moved") rescue nil
250+
251+
# touch a new file
252+
fd = session.fs.file.open("meterpreter-test", "wb")
253+
fd.close
254+
255+
session.fs.file.mv("meterpreter-test", "meterpreter-test-moved")
256+
entries = session.fs.dir.entries
257+
res &&= entries.include?("meterpreter-test-moved")
258+
res &&= !entries.include?("meterpreter-test")
259+
260+
# clean up
261+
session.fs.file.rm("meterpreter-test") rescue nil
262+
session.fs.file.rm("meterpreter-test-moved") rescue nil
263+
264+
res
265+
end
266+
end
244267

245268
it "should do md5 and sha1 of files" do
246269
res = true
@@ -270,6 +293,12 @@ def test_fs
270293

271294
end
272295

296+
=begin
297+
# Sniffer currently crashes on any OS that requires driver signing,
298+
# i.e. everything vista and newer
299+
#
300+
# Disable loading it for now to make it through the rest of the tests.
301+
#
273302
def test_sniffer
274303
begin
275304
session.core.use "sniffer"
@@ -285,6 +314,7 @@ def test_sniffer
285314
286315
# XXX: how do we test this more thoroughly in a generic way?
287316
end
317+
=end
288318

289319
def cleanup
290320
vprint_status("Cleanup: changing working directory back to #{@old_pwd}")

0 commit comments

Comments
 (0)