Issue 335: fixed another issue with Dynamic command modules when selecting the command results

git-svn-id: https://beef.googlecode.com/svn/trunk@956 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
antisnatchor
2011-05-05 14:50:51 +00:00
parent 0f17fa0808
commit 1bc37a2ed1

View File

@@ -534,16 +534,19 @@ class Modules < BeEF::Extension::AdminUI::HttpController
raise WEBrick::HTTPStatus::BadRequest, "Command is nil" if command.nil?
command_module = BeEF::Core::Models::CommandModule.get(command.command_module_id)
if(command_module.path.split('/').first.match(/^Dynamic/))
command_module = command_module.path.split('/').last
end
raise WEBrick::HTTPStatus::BadRequest, "command_module is nil" if command_module.nil?
e = BeEF::Core::Command.const_get(command_module.name.capitalize).new
if(command_module.path.split('/').first.match(/^Dynamic/))
dyn_mod_name = command_module.path.split('/').last
e = BeEF::Modules::Commands.const_get(dyn_mod_name.capitalize).new
else
command_module_name = command_module.name
e = BeEF::Core::Command.const_get(command_module_name.capitalize).new
end
@body = {
'success' => 'true',
'command_module_name' => command_module.name,
'command_module_name' => command_module_name,
'command_module_id' => command_module.id,
'data' => JSON.parse(command.data),
'definition' => JSON.parse(e.to_json)