Files
metasploit-gs/data/msfweb/app/controllers/payloads_controller.rb
T
lmh 28c9160947 You all will see the power of this fully functional payload generation. (Hrm, that sounded familiar).
git-svn-id: file:///home/svn/framework3/trunk@4007 4d416f70-5f16-0410-b530-b9f4589650da
2006-10-02 20:39:52 +00:00

54 lines
1.3 KiB
Ruby

# Author: L.M.H <lmh@info-pull.com>
# Description: The payload controller of msfweb v.3. Handles views, listing
# and other actions related to payload modules. Code and processing goes here.
# Instance variables, final values, etc, go into views.
class PayloadsController < ApplicationController
layout 'windows'
def list
end
def view
@tmod = get_view_for_module("payload", params[:id])
unless @tmod
render_text "Unknown module specified."
end
@module_step = (params[:step] || 0).to_i
if @module_step == 1
modinst = Payload.create(@tmod.refname)
badchars = params[:badchars]
pencoder = params[:encoder]
pformat = params[:format]
max_size = (params[:max_size] || 0).to_i
payload_opts = ''
params.each_pair { |k, v|
next if (v == nil or v.length == 0)
if (k =~ /^opt_(.*)$/)
payload_opts += "#{$1}=#{v} "
end
}
begin
@generation = modinst.generate_simple(
'Encoder' => (pencoder == '__default') ? nil : pencoder,
'BadChars' => badchars,
'Format' => pformat || 'c',
'OptionStr' => payload_opts,
'MaxSize' => (max_size == 0) ? nil : max_size)
rescue
@generation = $!
end
end
# end of view method
end
def generate
end
end