fixes issues 171

git-svn-id: https://beef.googlecode.com/svn/trunk@678 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
vitaly.osipov@gmail.com
2011-01-07 04:28:30 +00:00
parent f04a86337f
commit a4d4d69b87
2 changed files with 8 additions and 4 deletions

View File

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

View File

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