Changed BeEF::API::Registra to BeEF::API::Registrar

git-svn-id: https://beef.googlecode.com/svn/trunk@1358 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
buherator@gmail.com
2011-10-09 15:31:52 +00:00
parent 20f07a5b04
commit ab1ec19a5c
18 changed files with 38 additions and 38 deletions

2
beef
View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)