2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2005-11-28 14:26:33 +00:00
|
|
|
#
|
|
|
|
# This sample demonstrates how a file can be encoded using a framework
|
|
|
|
# encoder.
|
|
|
|
#
|
|
|
|
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
|
|
|
|
|
|
|
|
require 'msf/base'
|
|
|
|
|
|
|
|
if (ARGV.empty?)
|
|
|
|
puts "Usage: #{File.basename(__FILE__)} encoder_name file_name format"
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
|
|
|
|
framework = Msf::Simple::Framework.create
|
|
|
|
|
|
|
|
begin
|
|
|
|
# Create the encoder instance.
|
|
|
|
mod = framework.encoders.create(ARGV.shift)
|
|
|
|
|
|
|
|
puts(Msf::Simple::Buffer.transform(
|
2006-12-17 07:00:44 +00:00
|
|
|
mod.encode(IO.read(ARGV.shift)), ARGV.shift || 'ruby'))
|
2005-11-28 14:26:33 +00:00
|
|
|
rescue
|
|
|
|
puts "Error: #{$!}\n\n#{$@.join("\n")}"
|
|
|
|
end
|