2005-05-21 18:27:24 +00:00
|
|
|
#!/usr/bin/ruby -I../Lib -I../Modules
|
2005-05-15 21:32:55 +00:00
|
|
|
|
2005-05-21 18:27:24 +00:00
|
|
|
require 'Msf/Core'
|
2005-05-21 07:18:40 +00:00
|
|
|
require 'Encoders/IA32/JmpCallAdditive'
|
2005-05-18 04:42:56 +00:00
|
|
|
require 'Nops/IA32/SingleByte'
|
2005-05-15 21:32:55 +00:00
|
|
|
|
|
|
|
framework = Msf::Framework.new
|
|
|
|
|
|
|
|
framework.add_log_sink(Msf::Logging::Sinks::Flatfile.new('/tmp/msfcli.log'))
|
|
|
|
|
|
|
|
#encoder = framework.encoders.instantiate('gen_ia32_jmp_call_additive')
|
|
|
|
encoder = Msf::Encoders::Generic::IA32::JmpCallAdditive.new
|
|
|
|
|
2005-05-17 04:22:42 +00:00
|
|
|
puts "#{encoder.author_to_s}"
|
|
|
|
puts "#{encoder.arch_to_s}"
|
|
|
|
|
2005-05-17 04:30:56 +00:00
|
|
|
puts "#{encoder.arch?('ia32')} #{encoder.arch?('jabba')}"
|
|
|
|
|
2005-05-15 21:32:55 +00:00
|
|
|
begin
|
|
|
|
encoded = encoder.encode("\xcc\x90\x90\x90ABCDEFGHIJKLMNOPQRSTUVWXYZ", "\x87")
|
|
|
|
rescue Msf::Encoding::BadcharException => detail
|
|
|
|
puts "bad char at #{detail.index} #{detail.buf.unpack('H*')[0]}"
|
|
|
|
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
|
|
|
|
puts encoded.unpack("H*")[0]
|
2005-05-18 04:42:56 +00:00
|
|
|
|
|
|
|
nop = Msf::Nops::IA32::SingleByte.new
|
|
|
|
|
|
|
|
sled = nop.generate_sled(
|
|
|
|
100,
|
|
|
|
'Random' => true)
|
|
|
|
# 'Badchars' => "\x95")
|
|
|
|
# 'SaveRegisters' => [ 'eax' ])
|
|
|
|
|
|
|
|
puts sled.unpack("H*")[0]
|