2005-06-09 06:12:32 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
2005-06-09 06:18:27 +00:00
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..'))
|
2005-06-09 06:12:32 +00:00
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'Dev', 'machinetest'))
|
|
|
|
|
|
|
|
require 'machinetest'
|
|
|
|
require 'test/unit'
|
|
|
|
require 'Rex/Encoders/XorDWord'
|
|
|
|
|
|
|
|
class Rex::Encoders::XorDWord::UnitTest < ::Test::Unit::TestCase
|
|
|
|
Klass = Rex::Encoders::XorDWord
|
2005-06-09 18:13:01 +00:00
|
|
|
def klass
|
|
|
|
self.class::Klass
|
|
|
|
end
|
|
|
|
|
2005-06-09 06:12:32 +00:00
|
|
|
def test_encode
|
2005-06-09 18:13:01 +00:00
|
|
|
1000.times {
|
2005-06-09 06:12:32 +00:00
|
|
|
buffer = ""
|
2005-06-09 18:13:01 +00:00
|
|
|
rand(5000).times { buffer << 0x90 }
|
|
|
|
assert_equal(nil, MachineTest.testraw(klass.encode(buffer + "\xcc")))
|
2005-06-09 06:12:32 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|