2007-02-18 00:10:39 +00:00
|
|
|
##
|
2008-10-02 05:23:59 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2005-11-01 00:48:40 +00:00
|
|
|
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
|
|
|
|
$:.unshift(File.dirname(__FILE__))
|
|
|
|
|
|
|
|
require 'test/unit'
|
|
|
|
require 'rex/ui'
|
|
|
|
require 'msf/core'
|
|
|
|
require 'countdown'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Test::Unit::TestCase
|
2005-11-01 00:48:40 +00:00
|
|
|
|
|
|
|
Klass = Msf::Encoders::X86::Countdown
|
|
|
|
|
|
|
|
def test_encoder
|
|
|
|
|
|
|
|
k = Klass.new
|
|
|
|
|
|
|
|
{
|
2010-04-30 08:40:19 +00:00
|
|
|
"\xcc\xcc\xcc\xcc" =>
|
2005-11-01 00:48:40 +00:00
|
|
|
[
|
|
|
|
"\x6a\x03\x59\xe8\xff\xff\xff\xff\xc1\x5e\x30\x4c\x0e\x07" +
|
|
|
|
"\xe2\xfa\xcd\xce\xcf\xc8",
|
|
|
|
4
|
|
|
|
],
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" =>
|
|
|
|
[
|
|
|
|
"\x6a\x19\x59\xe8\xff\xff\xff\xff\xc1\x5e\x30\x4c\x0e\x07" +
|
|
|
|
"\xe2\xfa\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40" +
|
|
|
|
"\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40\x40",
|
|
|
|
4
|
|
|
|
]
|
|
|
|
}.each_pair { |raw, real|
|
|
|
|
offset = real[1] || 0
|
|
|
|
|
|
|
|
encoded = k.encode(raw, '')
|
|
|
|
|
|
|
|
assert_equal(real[0][offset, -1], encoded[offset, -1])
|
|
|
|
}
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-01 00:48:40 +00:00
|
|
|
end
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|