2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2005-12-08 15:37:10 +00:00
|
|
|
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..'))
|
|
|
|
|
|
|
|
require 'test/unit'
|
|
|
|
require 'rex/text'
|
|
|
|
require 'rex/assembly/nasm'
|
|
|
|
|
|
|
|
class Rex::Assembly::Nasm::UnitTest < ::Test::Unit::TestCase
|
|
|
|
|
|
|
|
Klass = Rex::Assembly::Nasm
|
|
|
|
|
|
|
|
def test_assemble
|
2005-12-30 20:24:44 +00:00
|
|
|
assert_equal("\x6a\x00", Klass.assemble("push byte 0x00"))
|
|
|
|
assert_equal("\xb2\xb4", Klass.assemble("mov dl, 0xb4"))
|
2005-12-08 15:37:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_disassemble
|
|
|
|
assert_equal("00000000 31C0 xor eax,eax\n", Klass.disassemble("\x31\xc0"))
|
|
|
|
end
|
|
|
|
|
2008-10-19 21:03:39 +00:00
|
|
|
end
|