From 048405d4f129af6c421b1523a38e845870acb631 Mon Sep 17 00:00:00 2001 From: bcoles Date: Sun, 12 Jan 2014 19:09:11 +1030 Subject: [PATCH] Add dynamic module options --- tools/csrf_to_beef | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/csrf_to_beef b/tools/csrf_to_beef index 0ab822f3d..505787f83 100644 --- a/tools/csrf_to_beef +++ b/tools/csrf_to_beef @@ -81,8 +81,8 @@ end class ModuleFile def generate class_name, target_url, options options_rb = "" - options.each do |input_name,input_value| - options_rb += " { 'name' => '#{input_name}', 'ui_label' => '#{input_name}', 'value' => '#{input_value}' },\n" + options.to_enum.with_index(1).each do |input, input_index| + options_rb += " { 'name' => 'input_#{input_index}', 'ui_label' => '#{input[0]}', 'value' => '#{input[1]}' },\n" end return <<-EOF # @@ -112,8 +112,8 @@ end class CommandFile def generate class_name, method, enctype, options options_js = "" - options.each do |input_name,input_value| - options_js += " {'type':'hidden', 'name':'#{input_name}', 'value':'#{input_value}' },\n" + options.to_enum.with_index(1).each do |input, input_index| + options_js += " {'type':'hidden', 'name':'#{input.first}', 'value':'<%= @input_#{input_index} %>' },\n" end return <<-EOF //