diff --git a/data/msfweb/app/controllers/payloads_controller.rb b/data/msfweb/app/controllers/payloads_controller.rb index 7e141e6a31..b6668cb61a 100644 --- a/data/msfweb/app/controllers/payloads_controller.rb +++ b/data/msfweb/app/controllers/payloads_controller.rb @@ -15,11 +15,36 @@ class PayloadsController < ApplicationController unless @tmod render_text "Unknown module specified." end + + @module_step = (params[:step] || 0).to_i - if params[:step] - @module_step = params[:step] + 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 diff --git a/data/msfweb/app/models/payload.rb b/data/msfweb/app/models/payload.rb index ccc6eb9c25..eb58ace958 100644 --- a/data/msfweb/app/models/payload.rb +++ b/data/msfweb/app/models/payload.rb @@ -4,4 +4,9 @@ class Payload $msframework.payloads.each_module { |n,m| mods << m.new } mods end + + def self.create(refname) + modinst = $msframework.payloads.create(refname) + modinst + end end diff --git a/data/msfweb/app/views/payloads/view.rhtml b/data/msfweb/app/views/payloads/view.rhtml index 6671547f9c..299a5473f6 100644 --- a/data/msfweb/app/views/payloads/view.rhtml +++ b/data/msfweb/app/views/payloads/view.rhtml @@ -1,5 +1,5 @@ - +

@@ -44,40 +44,86 @@

- - - <%= start_form_tag %> + + + + + +<% if @module_step == 0 %> + + + + + + + <%= hidden_field_tag "id", h(params[:id]) %> + <%= hidden_field_tag "step", "1" %> <% @tmod.options.each { |name, option| next if (option.advanced?) next if (option.evasion?) %> - <%= name %> - <%= (option.required?) ? "Required" : "Optional" %> - <%= option.type %> - - <%= html_escape(option.desc) %> + + + + + + + + <% } %> + + + + + + + + + + + + + + + - Max Size: - - Restricted Characters (format: 0x00 0x01): - - Selected Encoder:
- - - Format:
- - - <%= submit_tag %> - <%= end_form_tag %> -
Operating system: <%= @tmod.platform_to_s %>
Options
<%= name %><%= (option.required?) ? "Required" : "Optional" %>
<%= html_escape(option.desc) %> (type: <%= option.type %>) + +
Max Size:
Restricted Characters (format: 0x00 0x01):
Selected Encoder: + +
+ + Format: + + + + + + + <%= submit_tag "Generate" %> + + + +<% else %> + + + + Payload code + (<%= link_to "back", :action => "view", :id => h(params[:id]) %>) + + + + +
<%=@generation%>
+ +<% end %> + \ No newline at end of file diff --git a/data/msfweb/public/stylesheets/windows.css b/data/msfweb/public/stylesheets/windows.css index df78e95854..81ad3f0655 100644 --- a/data/msfweb/public/stylesheets/windows.css +++ b/data/msfweb/public/stylesheets/windows.css @@ -75,3 +75,8 @@ p.moduleDesc { color: #333333; text-align: justify; } + +th.moduleOptionsHeader { + background: #ddd; + text-transform: uppercase; +} \ No newline at end of file