From 98a0f50e937293b8ca473958ab0f86ebefe55c8e Mon Sep 17 00:00:00 2001 From: "scotty.b.brown@gmail.com" Date: Tue, 26 Jul 2011 10:51:58 +0000 Subject: [PATCH] More work #329 git-svn-id: https://beef.googlecode.com/svn/trunk@1108 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- core/module.rb | 1 + .../admin_ui/controllers/modules/modules.rb | 16 +++++++---- modules/misc/alert_dialog/module.rb | 28 ++++++------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/core/module.rb b/core/module.rb index 339e3ea20..629be2c23 100644 --- a/core/module.rb +++ b/core/module.rb @@ -31,6 +31,7 @@ module Module return (self.is_enabled(mod) and BeEF::Core::Configuration.instance.get('beef.module.'+mod.to_s+'.loaded') == true) end + # Gets all module options def self.get_options(mod) begin class_name = BeEF::Core::Configuration.instance.get("beef.module.#{mod}.class") diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index 03af2f4ba..520b9ea04 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -679,12 +679,16 @@ class Modules < BeEF::Extension::AdminUI::HttpController i = 1 config = BeEF::Core::Configuration.instance command_modules.each do |command_module| - mod = config.get('beef.module.'+command_module) - next if not File.exists?("#{$root_dir}"+mod['db']['path']) - - e = BeEF::Core::Command.const_get(mod['class']).new - command_modules_json[i] = JSON.parse(e.to_json) - i += 1 + if BeEF::Module.is_enabled(command_module) + h = { + 'Name'=> config.get("beef.module.#{command_module}.name"), + 'Description'=> config.get("beef.module.#{command_module}.description"), + 'Category'=> config.get("beef.module.#{command_module}.category"), + 'Data'=> BeEF::Module.get_options(command_module) + } + command_modules_json[i] = h + i += 1 + end end if not command_modules_json.empty? diff --git a/modules/misc/alert_dialog/module.rb b/modules/misc/alert_dialog/module.rb index 1f57ecc51..46696eaa5 100644 --- a/modules/misc/alert_dialog/module.rb +++ b/modules/misc/alert_dialog/module.rb @@ -41,30 +41,18 @@ class Alert_dialog < BeEF::Core::Command # set and return all options for this module def self.options - return { - 'name' => 'alert_dialog', + return [{ + 'name' => 'text', 'description' => 'Sends an alert dialog to the victim', - 'type' => 'textarea', 'filter' => '', - 'default_value' => 'Alert box text', - 'adminui_width' => '400px', - 'adminui_height' => '100px' - } + 'type' => 'textarea', + 'ui_label' => 'Alert text', + 'value' => 'Alert box text', + 'width' => '400px', + 'height' => '100px' + }] end - # set and return all options for this module - def self.options - return { - 'name' => 'alert_dialog', - 'description' => 'Sends an alert dialog to the victim', - 'type' => 'textarea', - 'filter' => '', - 'default_value' => 'Alert box text', - 'adminui_width' => '400px', - 'adminui_height' => '100px' - } - end - def callback content = {} content['User Response'] = "The user clicked the 'OK' button when presented with an alert box."