Files
metasploit-gs/lib/msf/core/exploit.rb.ut.rb
T
Matt Miller a7c99d2ce2 capabilities
git-svn-id: file:///home/svn/incoming/trunk@2571 4d416f70-5f16-0410-b530-b9f4589650da
2005-06-04 22:39:12 +00:00

45 lines
1.5 KiB
Ruby

#!/usr/bin/ruby
$:.unshift(File.join('..', '..', File.dirname(__FILE__)))
require 'test/unit'
require 'Msf/Core'
module Msf
class Exploit::UnitTest < Test::Unit::TestCase
class StubExploit < Msf::Exploit
def auto_target
return nil
end
end
class Stub2Exploit < Msf::Exploit
def check
end
end
def test_support
assert_equal(false, Exploit.new.supports_auto_target?, "auto target support check failed")
assert_equal(true, StubExploit.new.supports_auto_target?, "auto target deriv enabled support check failed")
assert_equal(false, Stub2Exploit.new.supports_auto_target?, "auto target deriv disabled support check failed")
assert_equal(false, Exploit.new.supports_check?, "auto target support check failed")
assert_equal(false, StubExploit.new.supports_check?, "auto target deriv enabled support check failed")
assert_equal(true, Stub2Exploit.new.supports_check?, "auto target deriv disabled support check failed")
assert_equal(false, Exploit.new.capabilities['check'], "auto target capabilities check failed")
assert_equal(false, StubExploit.new.capabilities['check'], "auto target deriv enabled capabilities check failed")
assert_equal(true, Stub2Exploit.new.capabilities['check'], "auto target deriv disabled capabilities check failed")
end
def test_defaults
e = Exploit.new
assert_equal(Msf::Exploit::CheckCode::Unsupported, e.check, "invalid default check")
assert_equal(nil, e.auto_target, "invalid default auto_target")
end
end
end