Files
metasploit-gs/lib/msf/core/exploit.rb.ut.rb
T

37 lines
1.0 KiB
Ruby
Raw Normal View History

2005-12-17 06:46:23 +00:00
#!/usr/bin/env ruby
2005-06-04 22:26:42 +00:00
2005-06-09 06:18:27 +00:00
$:.unshift(File.join(File.dirname(__FILE__), '..', '..'))
2005-06-04 22:26:42 +00:00
require 'test/unit'
2005-07-09 21:18:49 +00:00
require 'msf/core'
2005-06-04 22:26:42 +00:00
module Msf
class Exploit::UnitTest < Test::Unit::TestCase
class StubExploit < Msf::Exploit
end
class Stub2Exploit < Msf::Exploit
def check
end
end
def test_support
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")
2005-06-04 22:39:12 +00:00
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")
2005-06-04 22:26:42 +00:00
end
def test_defaults
e = Exploit.new
assert_equal(Msf::Exploit::CheckCode::Unsupported, e.check, "invalid default check")
end
end
2008-10-19 21:03:39 +00:00
end