diff --git a/core/bootstrap.rb b/core/bootstrap.rb index 2ce5f8643..148136e79 100644 --- a/core/bootstrap.rb +++ b/core/bootstrap.rb @@ -19,6 +19,11 @@ module BeEF end end +## @note Include the BeEF router +require 'core/main/router/router' +require 'core/main/router/api' + + ## @note Include http server functions for beef require 'core/main/server' require 'core/main/handlers/modules/beefjs' diff --git a/core/main/router/api.rb b/core/main/router/api.rb new file mode 100644 index 000000000..7bad31f33 --- /dev/null +++ b/core/main/router/api.rb @@ -0,0 +1,30 @@ +# +# Copyright 2012 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 Core + module Router + + module RegisterRouterHandler + def self.mount_handler(server) + server.mount('/', BeEF::Core::Router::Router.new) + end + end + + BeEF::API::Registrar.instance.register(BeEF::Core::Router::RegisterRouterHandler, BeEF::API::Server, 'mount_handler') + + end + end +end diff --git a/core/main/router/router.rb b/core/main/router/router.rb new file mode 100644 index 000000000..88ecccee8 --- /dev/null +++ b/core/main/router/router.rb @@ -0,0 +1,33 @@ +# +# Copyright 2012 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 Core + module Router + class Router < Sinatra::Base + + config = BeEF::Core::Configuration.instance + configure do set :show_exceptions, false end + not_found do 'Not Found' end + + get '/' do + 'Try harder...muahah!' + end + + end + end + end +end \ No newline at end of file