diff --git a/core/api.rb b/core/api.rb index 603297990..11c7995f7 100644 --- a/core/api.rb +++ b/core/api.rb @@ -54,6 +54,7 @@ end end require 'core/api/module' +require 'core/api/modules' require 'core/api/extension' require 'core/api/extensions' require 'core/api/main/migration' diff --git a/core/api/modules.rb b/core/api/modules.rb new file mode 100644 index 000000000..c1cb876b1 --- /dev/null +++ b/core/api/modules.rb @@ -0,0 +1,30 @@ +# +# Copyright 2011 Wade Alcorn wade@bindshell.net +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +module BeEF +module API + + module Modules + + API_PATHS = { + 'post_soft_load' => :post_soft_load + } + + def post_soft_load; end + + end + +end +end diff --git a/core/module.rb b/core/module.rb index 2167d4ebb..b14e61cf1 100644 --- a/core/module.rb +++ b/core/module.rb @@ -79,8 +79,8 @@ module Module config = BeEF::Core::Configuration.instance if self.is_enabled(mod) begin - require config.get("beef.module.#{mod}.path")+'/module.rb' - if self.exists?(mod) + require config.get("beef.module.#{mod}.path")+'module.rb' + if self.exists?(config.get("beef.module.#{mod}.class")) # start server mount point BeEF::Core::Server.instance.mount("/command/#{mod}.js", false, BeEF::Core::Handlers::Commands, mod) BeEF::Core::Configuration.instance.set("beef.module.#{mod}.mount", "/command/#{mod}.js") diff --git a/core/modules.rb b/core/modules.rb index 911a32636..c4a15f965 100644 --- a/core/modules.rb +++ b/core/modules.rb @@ -47,6 +47,7 @@ module Modules self.get_enabled.each { |k,v| BeEF::Module.soft_load(k) } + BeEF::API.fire(BeEF::API::Modules, 'post_soft_load') end end end