From a4d4d69b87e120b9a904e2d418433952aea23c95 Mon Sep 17 00:00:00 2001 From: "vitaly.osipov@gmail.com" Date: Fri, 7 Jan 2011 04:28:30 +0000 Subject: [PATCH] fixes issues 171 git-svn-id: https://beef.googlecode.com/svn/trunk@678 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- lib/server/modules/common.rb | 10 +++++++--- lib/server/zombiehandler.rb | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/server/modules/common.rb b/lib/server/modules/common.rb index 39a3863df..2436399e1 100644 --- a/lib/server/modules/common.rb +++ b/lib/server/modules/common.rb @@ -13,7 +13,7 @@ module Modules # @param: {Object} the hook session id # @param: {Boolean} if the framework is already loaded in the hooked browser # - def build_beefjs!() + def build_beefjs!(req_host) # set up values required to construct beefjs beefjs = '' # init the beefjs string (to be sent as the beefjs file) @@ -30,8 +30,12 @@ module Modules config = BeEF::Configuration.instance hook_session_name = config.get('hook_session_name') hook_session_config = BeEF::HttpHookServer.instance.to_h -# hook_session_config['beef_hook_session_name'] = hook_session_name -# hook_session_config['beef_hook_session_id'] = hook_session_id + + # if http_host="0.0.0.0" in config ini, use the host requested by client + if hook_session_config['beef_host'].eql? "0.0.0.0" + hook_session_config['beef_host'] = req_host + hook_session_config['beef_url'].sub!(/0\.0\.0\.0/, req_host) + end # populate place holders in the beefjs string and set the response body eruby = Erubis::FastEruby.new(beefjs) diff --git a/lib/server/zombiehandler.rb b/lib/server/zombiehandler.rb index 90174a58a..8c7c10e8b 100644 --- a/lib/server/zombiehandler.rb +++ b/lib/server/zombiehandler.rb @@ -44,7 +44,7 @@ module BeEF if not hooked_browser # is a new browser so return instructions to set up the hook # generate the instructions to hook the browser - build_beefjs!() + build_beefjs!(@request.host) else # is a known browseer so send instructions