Skip to content

Commit

Permalink
Add a test for stdapi_fs_file_move
Browse files Browse the repository at this point in the history
Also disables tests for sniffer, which is crashy.
  • Loading branch information
egypt committed Apr 5, 2013
1 parent 0671406 commit 7cf6918
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion test/modules/post/test/meterpreter.rb
Expand Up @@ -15,7 +15,6 @@ def initialize(info={})
'Description' => %q{ This module will test meterpreter API methods },
'License' => MSF_LICENSE,
'Author' => [ 'egypt'],
'Version' => '$Revision$',
'Platform' => [ 'windows', 'linux', 'java' ],
'SessionTypes' => [ 'meterpreter' ]
))
Expand Down Expand Up @@ -241,6 +240,30 @@ def test_fs
session.fs.file.rm(remote)
res
end
if session.commands.include?("stdapi_fs_file_move")
it "should move files" do
res = true

# Make sure we don't have leftovers from a previous run
session.fs.file.rm("meterpreter-test") rescue nil
session.fs.file.rm("meterpreter-test-moved") rescue nil

# touch a new file
fd = session.fs.file.open("meterpreter-test", "wb")
fd.close

session.fs.file.mv("meterpreter-test", "meterpreter-test-moved")
entries = session.fs.dir.entries
res &&= entries.include?("meterpreter-test-moved")
res &&= !entries.include?("meterpreter-test")

# clean up
session.fs.file.rm("meterpreter-test") rescue nil
session.fs.file.rm("meterpreter-test-moved") rescue nil

res
end
end

it "should do md5 and sha1 of files" do
res = true
Expand Down Expand Up @@ -270,6 +293,12 @@ def test_fs

end

=begin
# Sniffer currently crashes on any OS that requires driver signing,
# i.e. everything vista and newer
#
# Disable loading it for now to make it through the rest of the tests.
#
def test_sniffer
begin
session.core.use "sniffer"
Expand All @@ -285,6 +314,7 @@ def test_sniffer
# XXX: how do we test this more thoroughly in a generic way?
end
=end

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

0 comments on commit 7cf6918

Please sign in to comment.