Changed reliance upon filename to the configuration system. This works towards fixing issue #322
git-svn-id: https://beef.googlecode.com/svn/trunk@937 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -46,7 +46,7 @@ module Core
|
||||
# Super class controller
|
||||
def initialize(info)
|
||||
get_extensions
|
||||
|
||||
|
||||
@info = info
|
||||
@datastore = @info['Data'] || {}
|
||||
@friendlyname = @info['Name'] || nil
|
||||
|
||||
@@ -21,11 +21,9 @@ module Modules
|
||||
raise WEBrick::HTTPStatus::BadRequest, "command_module.path is nil" if command_module.path.nil?
|
||||
|
||||
if(command_module.path.match(/^Dynamic/))
|
||||
klass = command_module.path.split('/').last
|
||||
command_module = BeEF::Modules::Commands.const_get(klass.capitalize).new
|
||||
command_module = BeEF::Modules::Commands.const_get(command_module.name.capitalize).new
|
||||
else
|
||||
klass = command_module.path.split('/').reverse[1]
|
||||
command_module = BeEF::Core::Command.const_get(klass.capitalize).new
|
||||
command_module = BeEF::Core::Command.const_get(command_module.name.capitalize).new
|
||||
end
|
||||
|
||||
command_module.command_id = command.id
|
||||
|
||||
@@ -79,10 +79,8 @@ module Core
|
||||
mount("#{@configuration.get("beef.http.hook_file")}", true, BeEF::Core::Handlers::HookedBrowsers)
|
||||
|
||||
# Create http handlers for all commands in the framework
|
||||
Dir["#{root_dir}/modules/**/*.rb"].each { |command|
|
||||
#command_class = (File.basename command, '.rb').capitalize
|
||||
command_class = command.split('/').reverse[1]
|
||||
mount("/command/#{command_class}.js", false, BeEF::Core::Handlers::Commands, command_class)
|
||||
BeEF::Modules.get_loaded.each { |k,v|
|
||||
mount("/command/#{k}.js", false, BeEF::Core::Handlers::Commands, k)
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user