From 0e472deede1ba84a6afe969f72d9879bd80fd172 Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 27 Mar 2012 09:39:50 -0600 Subject: [PATCH] Add a simple test for unix shells --- test/modules/post/test/unix.rb | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/modules/post/test/unix.rb diff --git a/test/modules/post/test/unix.rb b/test/modules/post/test/unix.rb new file mode 100644 index 0000000000..8aefada1eb --- /dev/null +++ b/test/modules/post/test/unix.rb @@ -0,0 +1,50 @@ + +require 'module_test' + +#load 'test/lib/module_test.rb' +#load 'lib/rex/text.rb' +#load 'lib/msf/core/post/linux/system.rb' +#load 'lib/msf/core/post/unix/enum_user_dirs.rb' + +class Metasploit4 < Msf::Post + + include Msf::ModuleTest::PostTest + include Msf::Post::Linux::System + include Msf::Post::Unix + include Msf::Post::Common + + def initialize(info={}) + super( update_info( info, + 'Name' => 'Testing remote unix system manipulation', + 'Description' => %q{ This module will test Post::File API methods }, + 'License' => MSF_LICENSE, + 'Author' => [ 'egypt'], + 'Version' => '$Revision$', + 'Platform' => [ 'linux', 'java' ], + 'SessionTypes' => [ 'meterpreter', 'shell' ] + )) + end + + def test_unix + it "should list users" do + ret = true + users = get_users + ret &&= users.kind_of? Array + ret &&= users.length > 0 + have_root = false + if ret + users.each { |u| + next unless u[:name] == "root" + have_root = true + } + end + ret + ret &&= have_root + + ret + end + + end + +end +