diff --git a/beef b/beef index abd4fd731..9adc01f0e 100755 --- a/beef +++ b/beef @@ -95,7 +95,7 @@ BeEF::Extension::Console::Banners.print_network_interfaces_count BeEF::Extension::Console::Banners.print_network_interfaces_routes # @note Call the API method 'pre_http_start' -BeEF::API::Registra.instance.fire(BeEF::API::Server, 'pre_http_start', http_hook_server) +BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'pre_http_start', http_hook_server) # @note Start the HTTP Server, we addtionally check whether we load the Console Shell or not if config.get("beef.extension.console.shell.enable") == true diff --git a/core/api.rb b/core/api.rb index 84ddb495b..6f53edb8f 100644 --- a/core/api.rb +++ b/core/api.rb @@ -18,7 +18,7 @@ module BeEF module API # Registrar class to handle all registered timed API calls - class Registra + class Registrar include Singleton @@ -47,10 +47,10 @@ module API @count += 1 return id else - print_debug "API Registra: Attempting to re-register API call #{c.to_s} :#{method.to_s}" + print_debug "API Registrar: Attempting to re-register API call #{c.to_s} :#{method.to_s}" end else - print_error "API Registra: Attempted to register non-existant API method #{c.to_s} :#{method.to_s}" + print_error "API Registrar: Attempted to register non-existant API method #{c.to_s} :#{method.to_s}" end end diff --git a/core/extensions.rb b/core/extensions.rb index 7959a851f..9edde5543 100644 --- a/core/extensions.rb +++ b/core/extensions.rb @@ -36,7 +36,7 @@ module Extensions BeEF::Extension.load(k) } # API post extension load - BeEF::API::Registra.instance.fire(BeEF::API::Extensions, 'post_load') + BeEF::API::Registrar.instance.fire(BeEF::API::Extensions, 'post_load') end end diff --git a/core/main/configuration.rb b/core/main/configuration.rb index a4feababf..be6b4c317 100644 --- a/core/main/configuration.rb +++ b/core/main/configuration.rb @@ -115,7 +115,7 @@ module Core y['beef']['module'][y['beef']['module'].keys.first]['path'] = cf.gsub(/config\.yaml/, '').gsub(/#{$root_dir}\//, '') @config = y.deep_merge(@config) # API call for post module config load - BeEF::API::Registra.instance.fire(BeEF::API::Configuration, 'module_configuration_load', y['beef']['module'].keys.first) + BeEF::API::Registrar.instance.fire(BeEF::API::Configuration, 'module_configuration_load', y['beef']['module'].keys.first) end end end diff --git a/core/main/handlers/hookedbrowsers.rb b/core/main/handlers/hookedbrowsers.rb index 9c9fffa9e..155525e6c 100644 --- a/core/main/handlers/hookedbrowsers.rb +++ b/core/main/handlers/hookedbrowsers.rb @@ -84,7 +84,7 @@ module Handlers # # We dynamically get the list of all browser hook handler using the API and register them # - BeEF::API::Registra.instance.fire(BeEF::API::Server::Hook, 'pre_hook_send', hooked_browser, @body, @params, @request, @response) + BeEF::API::Registrar.instance.fire(BeEF::API::Server::Hook, 'pre_hook_send', hooked_browser, @body, @params, @request, @response) end # set response headers and body diff --git a/core/main/migration.rb b/core/main/migration.rb index 5124e2e59..e48c7e75f 100644 --- a/core/main/migration.rb +++ b/core/main/migration.rb @@ -51,7 +51,7 @@ module Core } # Call Migration method - BeEF::API::Registra.instance.fire(BeEF::API::Migration, 'migrate_commands') + BeEF::API::Registrar.instance.fire(BeEF::API::Migration, 'migrate_commands') end end diff --git a/core/main/network_stack/api.rb b/core/main/network_stack/api.rb index 955db5c69..a6c023dbd 100644 --- a/core/main/network_stack/api.rb +++ b/core/main/network_stack/api.rb @@ -29,7 +29,7 @@ module NetworkStack end # Register core API calls - BeEF::API::Registra.instance.register(BeEF::Core::NetworkStack::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Core::NetworkStack::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') end end diff --git a/core/main/server.rb b/core/main/server.rb index dfb20f830..4d26f05fc 100644 --- a/core/main/server.rb +++ b/core/main/server.rb @@ -96,7 +96,7 @@ module Core # # We dynamically get the list of all http handler using the API and register them # - BeEF::API::Registra.instance.fire(BeEF::API::Server, 'mount_handler', self) + BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'mount_handler', self) end end diff --git a/core/module.rb b/core/module.rb index d456dea04..2e45a6706 100644 --- a/core/module.rb +++ b/core/module.rb @@ -49,8 +49,8 @@ module Module # @return [Hash] a hash of all the module options # @note API Fire: get_options def self.get_options(mod) - if BeEF::API::Registra.instance.matched?(BeEF::API::Module, 'get_options', [mod]) - options = BeEF::API::Registra.instance.fire(BeEF::API::Module, 'get_options', mod) + if BeEF::API::Registrar.instance.matched?(BeEF::API::Module, 'get_options', [mod]) + options = BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'get_options', mod) mo = [] options.each{|o| if o[:data].kind_of?(Array) @@ -78,8 +78,8 @@ module Module # @return [Hash] a hash of all the module options # @note API Fire: get_options def self.get_payload_options(mod,payload) - if BeEF::API::Registra.instance.matched?(BeEF::API::Module, 'get_payload_options', [mod,nil]) - options = BeEF::API::Registra.instance.fire(BeEF::API::Module, 'get_payload_options', mod,payload) + if BeEF::API::Registrar.instance.matched?(BeEF::API::Module, 'get_payload_options', [mod,nil]) + options = BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'get_payload_options', mod,payload) return options end return [] @@ -93,7 +93,7 @@ module Module # @note API Fire: post_soft_load def self.soft_load(mod) # API call for pre-soft-load module - BeEF::API::Registra.instance.fire(BeEF::API::Module, 'pre_soft_load', mod) + BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'pre_soft_load', mod) config = BeEF::Core::Configuration.instance if not config.get("beef.module.#{mod}.loaded") if File.exists?(config.get('beef.module.'+mod+'.path')+'/module.rb') @@ -101,7 +101,7 @@ module Module self.parse_targets(mod) print_debug "Soft Load module: '#{mod}'" # API call for post-soft-load module - BeEF::API::Registra.instance.fire(BeEF::API::Module, 'post_soft_load', mod) + BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'post_soft_load', mod) return true else print_debug "Unable to locate module file: #{config.get('beef.module.'+mod+'.path')}module.rb" @@ -119,7 +119,7 @@ module Module # @note API Fire: post_hard_load def self.hard_load(mod) # API call for pre-hard-load module - BeEF::API::Registra.instance.fire(BeEF::API::Module, 'pre_hard_load', mod) + BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'pre_hard_load', mod) config = BeEF::Core::Configuration.instance if self.is_enabled(mod) begin @@ -131,7 +131,7 @@ module Module BeEF::Core::Configuration.instance.set('beef.module.'+mod+'.loaded', true) print_debug "Hard Load module: '#{mod.to_s}'" # API call for post-hard-load module - BeEF::API::Registra.instance.fire(BeEF::API::Module, 'post_hard_load', mod) + BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'post_hard_load', mod) return true else print_error "Hard loaded module '#{mod.to_s}' but the class BeEF::Core::Commands::#{mod.capitalize} does not exist" @@ -417,8 +417,8 @@ module Module print_error "Module not found '#{mod}'. Failed to execute module." return false end - if BeEF::API::Registra.instance.matched?(BeEF::API::Module, 'override_execute', [mod, nil,nil]) - BeEF::API::Registra.instance.fire(BeEF::API::Module, 'override_execute', mod, hbsession,opts) + if BeEF::API::Registrar.instance.matched?(BeEF::API::Module, 'override_execute', [mod, nil,nil]) + BeEF::API::Registrar.instance.fire(BeEF::API::Module, 'override_execute', mod, hbsession,opts) # @note We return true by default as we cannot determine the correct status if multiple API hooks have been called return true end diff --git a/core/modules.rb b/core/modules.rb index 28ab36936..1b076aa13 100644 --- a/core/modules.rb +++ b/core/modules.rb @@ -53,7 +53,7 @@ module Modules self.get_enabled.each { |k,v| BeEF::Module.soft_load(k) } - BeEF::API::Registra.instance.fire(BeEF::API::Modules, 'post_soft_load') + BeEF::API::Registrar.instance.fire(BeEF::API::Modules, 'post_soft_load') end end end diff --git a/extensions/admin_ui/api/handler.rb b/extensions/admin_ui/api/handler.rb index 28a293db7..ab3e6ef35 100644 --- a/extensions/admin_ui/api/handler.rb +++ b/extensions/admin_ui/api/handler.rb @@ -23,7 +23,7 @@ module API # module Handler - BeEF::API::Registra.instance.register(BeEF::Extension::AdminUI::API::Handler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::AdminUI::API::Handler, BeEF::API::Server, 'mount_handler') # # This function gets called automatically by the server. diff --git a/extensions/demos/api.rb b/extensions/demos/api.rb index 1bd691982..56f4202d9 100644 --- a/extensions/demos/api.rb +++ b/extensions/demos/api.rb @@ -19,7 +19,7 @@ module Demos module RegisterHttpHandlers - BeEF::API::Registra.instance.register(BeEF::Extension::Demos::RegisterHttpHandlers, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::Demos::RegisterHttpHandlers, BeEF::API::Server, 'mount_handler') def self.mount_handler(beef_server) # mount the handler to support the demos diff --git a/extensions/events/api.rb b/extensions/events/api.rb index e76794614..2a853fdfd 100644 --- a/extensions/events/api.rb +++ b/extensions/events/api.rb @@ -20,7 +20,7 @@ module Events module RegisterHttpHandler # Register API calls - BeEF::API::Registra.instance.register(BeEF::Extension::Events::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::Events::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') # # Mounts the http handlers for the events extension. We use that to retrieve stuff diff --git a/extensions/initialization/api.rb b/extensions/initialization/api.rb index 92760b163..39723f5ad 100644 --- a/extensions/initialization/api.rb +++ b/extensions/initialization/api.rb @@ -20,7 +20,7 @@ module Initialization module RegisterHttpHandler # Register API calls - BeEF::API::Registra.instance.register(BeEF::Extension::Initialization::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::Initialization::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') # # Register the http handler for the initialization script that retrieves diff --git a/extensions/metasploit/api.rb b/extensions/metasploit/api.rb index eb8eb3b74..4fae4a6c0 100644 --- a/extensions/metasploit/api.rb +++ b/extensions/metasploit/api.rb @@ -20,7 +20,7 @@ module API module MetasploitHooks - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Modules, 'post_soft_load') + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Modules, 'post_soft_load') # Load modules from metasploit just after all other module config is loaded def self.post_soft_load @@ -38,9 +38,9 @@ module API end count = 1 msf_module_config.each{|k,v| - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [k]) - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [k,nil]) - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'override_execute', [k, nil, nil]) + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [k]) + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [k,nil]) + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'override_execute', [k, nil, nil]) print_over "Loaded #{count} Metasploit exploits." count += 1 } @@ -69,9 +69,9 @@ module API 'path'=> path, 'class'=> 'Msf_module' } - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [key]) - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [key,nil]) - BeEF::API::Registra.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'override_execute', [key, nil, nil]) + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [key]) + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [key,nil]) + BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'override_execute', [key, nil, nil]) print_over "Loaded #{count} Metasploit exploits." count += 1 end diff --git a/extensions/proxy/api.rb b/extensions/proxy/api.rb index 93eb0986b..d14bfe5e8 100644 --- a/extensions/proxy/api.rb +++ b/extensions/proxy/api.rb @@ -20,8 +20,8 @@ module API module RegisterHttpHandler - BeEF::API::Registra.instance.register(BeEF::Extension::Proxy::API::RegisterHttpHandler, BeEF::API::Server, 'pre_http_start') - BeEF::API::Registra.instance.register(BeEF::Extension::Proxy::API::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::Proxy::API::RegisterHttpHandler, BeEF::API::Server, 'pre_http_start') + BeEF::API::Registrar.instance.register(BeEF::Extension::Proxy::API::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') def self.pre_http_start(http_hook_server) proxy = BeEF::Extension::Proxy::HttpProxyZombie.instance diff --git a/extensions/requester/api.rb b/extensions/requester/api.rb index 6bfb6adc8..56aa0aeaa 100644 --- a/extensions/requester/api.rb +++ b/extensions/requester/api.rb @@ -19,7 +19,7 @@ module Requester module RegisterHttpHandler - BeEF::API::Registra.instance.register(BeEF::Extension::Requester::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::Requester::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') # We register the http handler for the requester. # This http handler will retrieve the http responses for all requests @@ -31,7 +31,7 @@ module Requester module RegisterPreHookCallback - BeEF::API::Registra.instance.register(BeEF::Extension::Requester::RegisterPreHookCallback, BeEF::API::Server::Hook, 'pre_hook_send') + BeEF::API::Registrar.instance.register(BeEF::Extension::Requester::RegisterPreHookCallback, BeEF::API::Server::Hook, 'pre_hook_send') def self.pre_hook_send(hooked_browser, body, params, request, response) dhook = BeEF::Extension::Requester::API::Hook.new diff --git a/extensions/xssrays/api.rb b/extensions/xssrays/api.rb index 7e036fca0..040b4adbd 100644 --- a/extensions/xssrays/api.rb +++ b/extensions/xssrays/api.rb @@ -19,7 +19,7 @@ module Xssrays module RegisterHttpHandler - BeEF::API::Registra.instance.register(BeEF::Extension::Xssrays::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') + BeEF::API::Registrar.instance.register(BeEF::Extension::Xssrays::RegisterHttpHandler, BeEF::API::Server, 'mount_handler') # We register the http handler for the requester. # This http handler will retrieve the http responses for all requests @@ -32,7 +32,7 @@ module Xssrays module RegisterPreHookCallback - BeEF::API::Registra.instance.register(BeEF::Extension::Xssrays::RegisterPreHookCallback, BeEF::API::Server::Hook, 'pre_hook_send') + BeEF::API::Registrar.instance.register(BeEF::Extension::Xssrays::RegisterPreHookCallback, BeEF::API::Server::Hook, 'pre_hook_send') # checks at every polling if there are new scans to be started def self.pre_hook_send(hooked_browser, body, params, request, response)