From 4980ca02a6326806046f869ed5a504e18009389e Mon Sep 17 00:00:00 2001 From: bcoles Date: Wed, 17 Apr 2013 22:05:31 +0930 Subject: [PATCH] Add `beef.client.debug` config property - Part of issue #862 Client-side debugging is disabled by default `beef.debug()` now only shows messages if `beef.client.debug` is true --- config.yaml | 4 ++++ core/main/client/beef.js | 1 + core/main/server.rb | 17 +++++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/config.yaml b/config.yaml index cc78202bb..a78a872a8 100644 --- a/config.yaml +++ b/config.yaml @@ -91,6 +91,10 @@ beef: crypto_default_value_length: 80 + # Enable client-side debugging + client: + debug: false + # You may override default extension configuration parameters here extension: requester: diff --git a/core/main/client/beef.js b/core/main/client/beef.js index 14f39e2a0..f2f64f928 100644 --- a/core/main/client/beef.js +++ b/core/main/client/beef.js @@ -37,6 +37,7 @@ if(typeof beef === 'undefined' && typeof window.beef === 'undefined') { * @param: {string} the debug string to return */ debug: function(msg) { + if (!<%= @client_debug %>) return; if (typeof console == "object" && typeof console.log == "function") { console.log(msg); } else { diff --git a/core/main/server.rb b/core/main/server.rb index 51bb3613a..fc9389042 100644 --- a/core/main/server.rb +++ b/core/main/server.rb @@ -34,16 +34,17 @@ module BeEF def to_h { - 'beef_version' => VERSION, - 'beef_url' => @url, + 'beef_version' => VERSION, + 'beef_url' => @url, 'beef_root_dir' => @root_dir, - 'beef_host' => @configuration.get('beef.http.host'), - 'beef_port' => @configuration.get('beef.http.port'), - 'beef_public' => @configuration.get('beef.http.public'), + 'beef_host' => @configuration.get('beef.http.host'), + 'beef_port' => @configuration.get('beef.http.port'), + 'beef_public' => @configuration.get('beef.http.public'), 'beef_public_port' => @configuration.get('beef.http.public_port'), - 'beef_dns' => @configuration.get('beef.http.dns'), - 'beef_hook' => @configuration.get('beef.http.hook_file'), - 'beef_proto' => @configuration.get('beef.http.https.enable') == true ? "https" : "http" + 'beef_dns' => @configuration.get('beef.http.dns'), + 'beef_hook' => @configuration.get('beef.http.hook_file'), + 'beef_proto' => @configuration.get('beef.http.https.enable') == true ? "https" : "http", + 'client_debug' => @configuration.get("beef.client.debug") } end