git-svn-id: https://beef.googlecode.com/svn/trunk@1046 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
58 lines
2.0 KiB
Ruby
58 lines
2.0 KiB
Ruby
#
|
|
# 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 Extension
|
|
module AdminUI
|
|
module API
|
|
|
|
#
|
|
# We use this module to register all the http handler for the Administrator UI
|
|
#
|
|
module Handler
|
|
|
|
# use of the API right here
|
|
extend BeEF::API::Server::Handler
|
|
|
|
#
|
|
# This function gets called automatically by the server.
|
|
#
|
|
def self.mount_handlers(beef_server)
|
|
# retrieve the configuration class instance
|
|
configuration = BeEF::Core::Configuration.instance
|
|
|
|
# registers the http controllers for the AdminUI extensions
|
|
Dir["#{$root_dir}/extensions/admin_ui/controllers/**/*.rb"].each { |http_module|
|
|
require http_module
|
|
mod_name = File.basename http_module, '.rb'
|
|
print_debug("Registering controller [#{mod_name}] for extension [AdminUI]")
|
|
beef_server.mount("/ui/#{mod_name}", true, BeEF::Extension::AdminUI::Handlers::UI, mod_name)
|
|
}
|
|
|
|
# mount the folder were we store static files (javascript, css, images) for the admin ui
|
|
media_dir = File.dirname(__FILE__)+'/../media/'
|
|
beef_server.mount('/ui/media', true, BeEF::Extension::AdminUI::Handlers::MediaHandler, media_dir)
|
|
|
|
# mount the favicon file
|
|
beef_server.mount('/favicon.ico', true, WEBrick::HTTPServlet::FileHandler, "#{media_dir}#{configuration.get("beef.extension.admin_ui.favicon_dir")}/#{configuration.get("beef.extension.admin_ui.favicon_file_name")}")
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|