Skip to content

Instantly share code, notes, and snippets.

@xntrik
Created February 18, 2012 01:14
Show Gist options
  • Save xntrik/1856698 to your computer and use it in GitHub Desktop.
Save xntrik/1856698 to your computer and use it in GitHub Desktop.
beefjs matches
Searching 470 files for "beefjs"
/Users/xian/beef/beef/core/core.rb:
48 require 'core/main/server'
49
50: require 'core/main/handlers/modules/beefjs'
51 require 'core/main/handlers/modules/command'
52
/Users/xian/beef/beef/core/main/command.rb:
48 class Command
49
50: attr_reader :datastore, :path, :default_command_url, :beefjs_components, :friendlyname
51 attr_accessor :zombie, :command_id, :session_id
52
..
69 @auto_update_zombie = false
70 @results = {}
71: @beefjs_components = {}
72 end
73
..
170 end
171
172: # Tells the framework to load a specific module of the BeEFJS library that the command will be using.
173: # @param [String] component String of BeEFJS component to load
174 # @note Example: use 'beef.net.local'
175 def use(component)
176: return if @beefjs_components.include? component
177
178 component_path = '/'+component
...
181 component_path.replace "#{$root_dir}/core/main/client/#{component_path}.js"
182
183: raise "Invalid beefjs component for command module #{@path}" if not File.exists?(component_path)
184
185: @beefjs_components[component] = component_path
186 end
187
/Users/xian/beef/beef/core/main/client/beef.js:
25 if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
26
27: var BeefJS = {
28
29 version: '<%= @beef_version %>',
..
65 };
66
67: window.beef = BeefJS;
68 }
69
/Users/xian/beef/beef/core/main/handlers/commands.rb:
20 class Commands
21
22: include BeEF::Core::Handlers::Modules::BeEFJS
23 include BeEF::Core::Handlers::Modules::Command
24
/Users/xian/beef/beef/core/main/handlers/hookedbrowsers.rb:
22
23
24: include BeEF::Core::Handlers::Modules::BeEFJS
25 include BeEF::Core::Handlers::Modules::Command
26
..
56 host_name = @request.host
57 (print_error "Invalid host name";return) if not BeEF::Filters.is_valid_hostname?(host_name)
58: build_beefjs!(host_name)
59
60 # @note is a known browser so send instructions
/Users/xian/beef/beef/core/main/handlers/modules/beefjs.rb:
20
21 # @note Purpose: avoid rewriting several times the same code.
22: module BeEFJS
23
24: # Builds the default beefjs library (all default components of the library).
25 # @param [Object] req_host The request object
26: def build_beefjs!(req_host)
27
28: # @note set up values required to construct beefjs
29: beefjs = ''
30 # @note location of sub files
31: beefjs_path = "#{$root_dir}/core/main/client/"
32 js_sub_files = %w(lib/jquery-1.5.2.min.js lib/evercookie.js lib/json2.js beef.js browser.js browser/cookie.js browser/popup.js session.js os.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js)
33
34: # @note construct the beefjs string from file(s)
35 js_sub_files.each {|js_sub_file_name|
36: js_sub_file_abs_path = beefjs_path + js_sub_file_name
37: beefjs << (File.read(js_sub_file_abs_path) + "\n\n")
38 }
39
..
49 end
50
51: # @note populate place holders in the beefjs string and set the response body
52: eruby = Erubis::FastEruby.new(beefjs)
53 @body << eruby.evaluate(hook_session_config)
54
..
58 # @param [String] component Name of component
59 # @return [String|Boolean] Returns false if path was not found, otherwise returns component path
60: def find_beefjs_component_path(component)
61 component_path = component
62 component_path.gsub!(/beef./, '')
..
69 end
70
71: # Builds missing beefjs components.
72: # @param [Array] beefjs_components An array of component names
73: def build_missing_beefjs_components(beefjs_components)
74 # @note verifies that @beef_js_cmps is not nil to avoid bugs
75 @beef_js_cmps = '' if @beef_js_cmps.nil?
76
77: if beefjs_components.is_a? String
78: beefjs_components_path = find_beefjs_component_path(beefjs_components)
79: raise "Invalid component: could not build the beefjs file" if not beefjs_components_path
80: beefjs_components = {beefjs_components => beefjs_components_path}
81 end
82
83: beefjs_components.keys.each {|k|
84: next if @beef_js_cmps.include? beefjs_components[k]
85
86 # @note path to the component
87: component_path = beefjs_components[k]
88
89 # @note we output the component to the hooked browser
/Users/xian/beef/beef/core/main/handlers/modules/command.rb:
48 command_module.pre_send
49
50: build_missing_beefjs_components(command_module.beefjs_components) if not command_module.beefjs_components.empty?
51
52 @body << command_module.output + "\n\n"
/Users/xian/beef/beef/extensions/requester/api/hook.rb:
22 class Hook
23
24: include BeEF::Core::Handlers::Modules::BeEFJS
25
26 # If the HTTP table contains requests that need to be sent (has_ran = waiting), retrieve
..
36 return if output.empty?
37
38: # Build the BeEFJS requester component
39: build_missing_beefjs_components 'beef.net.requester'
40
41 # Send the command to perform the requests to the hooked browser
/Users/xian/beef/beef/extensions/xssrays/api/scan.rb:
21 class Scan
22
23: include BeEF::Core::Handlers::Modules::BeEFJS
24
25 #
..
40 xs.update(:is_started => true)
41
42: # build the beefjs xssrays component
43: build_missing_beefjs_components 'beef.net.xssrays'
44
45 # the URI of the XssRays handler where rays should come back if the vulnerability is verified
50 matches across 9 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment