2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2005-06-09 06:12:32 +00:00
|
|
|
|
2005-06-09 06:18:27 +00:00
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..'))
|
2005-07-09 21:57:37 +00:00
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'dev', 'machinetest'))
|
2005-06-09 06:12:32 +00:00
|
|
|
|
|
|
|
require 'machinetest'
|
|
|
|
require 'test/unit'
|
2005-07-09 21:57:37 +00:00
|
|
|
require 'rex/encoders/xor_dword'
|
2005-06-09 06:12:32 +00:00
|
|
|
|
2005-07-09 21:57:37 +00:00
|
|
|
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
|