From abac4ed3abef1d9d571cc292f592b03faacac900 Mon Sep 17 00:00:00 2001 From: "mosse.benjamin" Date: Wed, 24 Nov 2010 03:35:08 +0000 Subject: [PATCH] fixing the requester git-svn-id: https://beef.googlecode.com/svn/trunk@572 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- lib/filter/requester.rb | 2 +- lib/server/modules/common.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/filter/requester.rb b/lib/filter/requester.rb index 94a3f0c78..47822f615 100644 --- a/lib/filter/requester.rb +++ b/lib/filter/requester.rb @@ -12,7 +12,7 @@ module BeEF raise 'only GET or POST requests are supported for http requests' if not request.request_method.eql? 'GET' or request.request_method.eql? 'POST' #check uri - raise 'the uri is missing' if not webrick.unparsed_uri + raise 'the uri is missing' if not request.unparsed_uri #check host raise 'http host missing' if request.host.nil? diff --git a/lib/server/modules/common.rb b/lib/server/modules/common.rb index bb23044e7..f1b9dda97 100644 --- a/lib/server/modules/common.rb +++ b/lib/server/modules/common.rb @@ -39,6 +39,20 @@ module Modules end + # + # Finds the path to js components + # + def find_beefjs_component_path(component) + component_path = '/'+component + component_path.gsub!(/beef./, '') + component_path.gsub!(/\./, '/') + component_path.replace "#{$root_dir}/modules/beefjs/#{component_path}.js" + + return false if not File.exists? component_path + + component_path + end + # # Builds missing beefjs components. # @@ -48,6 +62,12 @@ module Modules # verifies that @beef_js_cmps is not nil to avoid bugs @beef_js_cmps = '' if @beef_js_cmps.nil? + if beefjs_components.is_a? String + beefjs_components_path = find_beefjs_component_path(beefjs_components) + raise "Invalid component: could not build the beefjs file" if not beefjs_components_path + beefjs_components = {beefjs_components => beefjs_components_path} + end + beefjs_components.keys.each {|k| next if @beef_js_cmps.include? beefjs_components[k]