execution time encoder testing

git-svn-id: file:///home/svn/incoming/trunk@3270 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2005-12-30 04:57:52 +00:00
parent a96cfa6b78
commit 537d0b0418
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
#!/usr/bin/env ruby
#
# This file tests all x86 encoders to ensure that they execute correctly.
#
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', 'dev', 'machinetest'))
require 'rex'
require 'msf/core'
require 'msf/base'
require 'machinetest'
$framework = Msf::Simple::Framework.create
$framework.encoders.each_module { |name, mod|
e = mod.new
h = {}
failed = 0
passed = 0
next if (e.arch?(ARCH_X86) == false)
1000.times {
if (MachineTest.testraw(buf = e.encode("\xcc")))
failed += 1
$stderr.puts("#{name.ljust(25)}: failure: #{Rex::Text.to_hex(buf)}")
else
passed += 1
end
h[buf] = true
}
$stderr.puts("#{name.ljust(25)}: Passed: #{passed}, Failed: #{failed}, Unique: #{h.keys.length}")
}