From a6986e3960568c40b402ff7609c58ab40d9a3baf Mon Sep 17 00:00:00 2001 From: bcoles Date: Wed, 4 Jan 2012 18:52:34 +1030 Subject: [PATCH 1/3] Added detection for Chrome 16, updated Chrome Extensions modules and split the Details tab "Browser Hook Initialization" into "Hooked Page", "Browser" and "Host" --- core/main/client/browser.js | 14 +++++- .../admin_ui/controllers/modules/modules.rb | 46 +++++++++---------- extensions/console/lib/shellinterface.rb | 46 +++++++++---------- .../execute_tabs/config.yaml | 2 +- .../grab_google_contacts/config.yaml | 1 + .../chrome_extensions/inject_beef/config.yaml | 1 + .../send_gvoice_sms/config.yaml | 5 +- 7 files changed, 64 insertions(+), 51 deletions(-) diff --git a/core/main/client/browser.js b/core/main/client/browser.js index 1ff439322..abd8ae49c 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -277,13 +277,21 @@ beef.browser = { isC15: function() { return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==15)?true:false); }, - + + /** + * Returns true if Chrome 16. + * @example: beef.browser.isC16() + */ + isC16: function() { + return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==16)?true:false); + }, + /** * Returns true if Chrome. * @example: beef.browser.isC() */ isC: function() { - return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12() || this.isC13() || this.isC14() || this.isC15(); + return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16(); }, /** @@ -346,6 +354,7 @@ beef.browser = { C13: this.isC13(), // Chrome 13 C14: this.isC14(), // Chrome 14 C15: this.isC15(), // Chrome 15 + C16: this.isC16(), // Chrome 16 C: this.isC(), // Chrome any version FF2: this.isFF2(), // Firefox 2 @@ -398,6 +407,7 @@ beef.browser = { if (this.isC13()) { return '13' }; // Chrome 13 if (this.isC14()) { return '14' }; // Chrome 14 if (this.isC15()) { return '15' }; // Chrome 15 + if (this.isC16()) { return '16' }; // Chrome 16 if (this.isFF2()) { return '2' }; // Firefox 2 diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index 1595b4f9f..86300c74a 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -66,7 +66,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_page_title_hash = { 'Page Title' => encoded_page_title } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_page_title_hash, 'from' => 'Initialization' } @@ -81,7 +81,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_page_uri_hash = { 'Page URI' => encoded_page_uri } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_page_uri_hash, 'from' => 'Initialization' } @@ -96,7 +96,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_page_referrer_hash = { 'Page Referrer' => encoded_page_referrer } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_page_referrer_hash, 'from' => 'Initialization' } @@ -111,7 +111,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_host_name_hash = { 'Hostname/IP' => encoded_host_name } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_host_name_hash, 'from' => 'Initialization' } @@ -126,7 +126,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_os_name_hash = { 'OS Name' => encoded_os_name } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_os_name_hash, 'from' => 'Initialization' } @@ -141,7 +141,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController browser_name_hash = { 'Browser Name' => friendly_browser_name } browser_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => browser_name_hash, 'from' => 'Initialization' } @@ -156,7 +156,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController browser_version_hash = { 'Browser Version' => encoded_browser_version } browser_version_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => browser_version_hash, 'from' => 'Initialization' } @@ -170,7 +170,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController browser_uastring_hash = { 'Browser UA String' => browser_uastring } browser_uastring_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => browser_uastring_hash, 'from' => 'Initialization' } @@ -185,7 +185,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_cookies_hash = { 'Cookies' => encoded_cookies } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_cookies_hash, 'from' => 'Initialization' } @@ -200,7 +200,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_browser_plugins_hash = { 'Browser Plugins' => encoded_browser_plugins } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_browser_plugins_hash, 'from' => 'Initialization' } @@ -215,7 +215,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_internal_ip_hash = { 'Internal IP' => encoded_internal_ip } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_internal_ip_hash, 'from' => 'Initialization' } @@ -230,7 +230,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_internal_hostname_hash = { 'Internal Hostname' => encoded_internal_hostname } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_internal_hostname_hash, 'from' => 'Initialization' } @@ -245,7 +245,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_system_platform_hash = { 'System Platform' => encoded_system_platform } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_system_platform_hash, 'from' => 'Initialization' } @@ -270,7 +270,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_screen_params_hash = { 'Screen Params' => encoded_screen_params } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_screen_params_hash, 'from' => 'Initialization' } @@ -293,7 +293,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_window_size_hash = { 'Window Size' => encoded_window_size } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_window_size_hash, 'from' => 'Initialization' } @@ -308,7 +308,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_java_enabled_hash = { 'Java Enabled' => encoded_java_enabled } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_java_enabled_hash, 'from' => 'Initialization' } @@ -323,7 +323,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_vbscript_enabled_hash = { 'VBScript Enabled' => encoded_vbscript_enabled } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_vbscript_enabled_hash, 'from' => 'Initialization' } @@ -338,7 +338,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_has_flash_hash = { 'Has Flash' => encoded_has_flash } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_flash_hash, 'from' => 'Initialization' } @@ -353,7 +353,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_has_googlegears_hash = { 'Has GoogleGears' => encoded_has_googlegears } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_googlegears_hash, 'from' => 'Initialization' } @@ -368,7 +368,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_has_web_socket_hash = { 'Has WebSockets' => encoded_has_web_socket } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_web_socket_hash, 'from' => 'Initialization' } @@ -383,7 +383,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_has_activex_hash = { 'Has ActiveX' => encoded_has_activex } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_activex_hash, 'from' => 'Initialization' } @@ -398,7 +398,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_has_session_cookies_hash = { 'Session Cookies' => encoded_has_session_cookies } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_session_cookies_hash, 'from' => 'Initialization' } @@ -413,7 +413,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController encoded_has_persistent_cookies_hash = { 'Persistent Cookies' => encoded_has_persistent_cookies } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_persistent_cookies_hash, 'from' => 'Initialization' } diff --git a/extensions/console/lib/shellinterface.rb b/extensions/console/lib/shellinterface.rb index c10d3fe27..1f65112cb 100644 --- a/extensions/console/lib/shellinterface.rb +++ b/extensions/console/lib/shellinterface.rb @@ -275,7 +275,7 @@ class ShellInterface encoded_page_title_hash = { 'Page Title' => encoded_page_title } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_page_title_hash, 'from' => 'Initialization' } @@ -290,7 +290,7 @@ class ShellInterface encoded_page_uri_hash = { 'Page URI' => encoded_page_uri } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_page_uri_hash, 'from' => 'Initialization' } @@ -305,7 +305,7 @@ class ShellInterface encoded_page_referrer_hash = { 'Page Referrer' => encoded_page_referrer } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_page_referrer_hash, 'from' => 'Initialization' } @@ -320,7 +320,7 @@ class ShellInterface encoded_host_name_hash = { 'Hostname/IP' => encoded_host_name } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_host_name_hash, 'from' => 'Initialization' } @@ -335,7 +335,7 @@ class ShellInterface encoded_os_name_hash = { 'OS Name' => encoded_os_name } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_os_name_hash, 'from' => 'Initialization' } @@ -350,7 +350,7 @@ class ShellInterface browser_name_hash = { 'Browser Name' => friendly_browser_name } browser_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => browser_name_hash, 'from' => 'Initialization' } @@ -365,7 +365,7 @@ class ShellInterface browser_version_hash = { 'Browser Version' => encoded_browser_version } browser_version_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => browser_version_hash, 'from' => 'Initialization' } @@ -379,7 +379,7 @@ class ShellInterface browser_uastring_hash = { 'Browser UA String' => browser_uastring } browser_uastring_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => browser_uastring_hash, 'from' => 'Initialization' } @@ -394,7 +394,7 @@ class ShellInterface encoded_cookies_hash = { 'Cookies' => encoded_cookies } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Hooked Page', 'data' => encoded_cookies_hash, 'from' => 'Initialization' } @@ -409,7 +409,7 @@ class ShellInterface encoded_browser_plugins_hash = { 'Browser Plugins' => encoded_browser_plugins } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_browser_plugins_hash, 'from' => 'Initialization' } @@ -424,7 +424,7 @@ class ShellInterface encoded_internal_ip_hash = { 'Internal IP' => encoded_internal_ip } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_internal_ip_hash, 'from' => 'Initialization' } @@ -439,7 +439,7 @@ class ShellInterface encoded_system_platform_hash = { 'System Platform' => encoded_system_platform } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_system_platform_hash, 'from' => 'Initialization' } @@ -454,7 +454,7 @@ class ShellInterface encoded_internal_hostname_hash = { 'Internal Hostname' => encoded_internal_hostname } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_internal_hostname_hash, 'from' => 'Initialization' } @@ -476,7 +476,7 @@ class ShellInterface encoded_screen_params_hash = { 'Screen Params' => encoded_screen_params } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Host', 'data' => encoded_screen_params_hash, 'from' => 'Initialization' } @@ -497,7 +497,7 @@ class ShellInterface encoded_window_size_hash = { 'Window Size' => encoded_window_size } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_window_size_hash, 'from' => 'Initialization' } @@ -512,7 +512,7 @@ class ShellInterface encoded_java_enabled_hash = { 'Java Enabled' => encoded_java_enabled } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_java_enabled_hash, 'from' => 'Initialization' } @@ -527,7 +527,7 @@ class ShellInterface encoded_vbscript_enabled_hash = { 'VBScript Enabled' => encoded_vbscript_enabled } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_vbscript_enabled_hash, 'from' => 'Initialization' } @@ -542,7 +542,7 @@ class ShellInterface encoded_has_flash_hash = { 'Has Flash' => encoded_has_flash } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_flash_hash, 'from' => 'Initialization' } @@ -557,7 +557,7 @@ class ShellInterface encoded_has_googlegears_hash = { 'Has GoogleGears' => encoded_has_googlegears } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_googlegears_hash, 'from' => 'Initialization' } @@ -572,7 +572,7 @@ class ShellInterface encoded_has_web_socket_hash = { 'Has GoogleGears' => encoded_has_web_socket } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_web_socket_hash, 'from' => 'Initialization' } @@ -587,7 +587,7 @@ class ShellInterface encoded_has_activex_hash = { 'Has ActiveX' => encoded_has_activex } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_activex_hash, 'from' => 'Initialization' } @@ -602,7 +602,7 @@ class ShellInterface encoded_has_session_cookies_hash = { 'Session Cookies' => encoded_has_session_cookies } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_session_cookies_hash, 'from' => 'Initialization' } @@ -617,7 +617,7 @@ class ShellInterface encoded_has_persistent_cookies_hash = { 'Persistent Cookies' => encoded_has_persistent_cookies } page_name_row = { - 'category' => 'Browser Hook Initialization', + 'category' => 'Browser', 'data' => encoded_has_persistent_cookies_hash, 'from' => 'Initialization' } diff --git a/modules/chrome_extensions/execute_tabs/config.yaml b/modules/chrome_extensions/execute_tabs/config.yaml index b95d00e4e..ae9c3031e 100644 --- a/modules/chrome_extensions/execute_tabs/config.yaml +++ b/modules/chrome_extensions/execute_tabs/config.yaml @@ -22,5 +22,5 @@ beef: description: "Open a new tab and execute the Javascript code on it. The Chrome Extension needs to have the 'tabs' permission, as well as access to the domain." authors: ["Kos", "antisnatchor"] target: - working: ["C"] user_notify: ["C"] + not_working: ["All"] diff --git a/modules/chrome_extensions/grab_google_contacts/config.yaml b/modules/chrome_extensions/grab_google_contacts/config.yaml index 5fdd56471..2046f12b6 100644 --- a/modules/chrome_extensions/grab_google_contacts/config.yaml +++ b/modules/chrome_extensions/grab_google_contacts/config.yaml @@ -23,3 +23,4 @@ beef: authors: ["Kos", "antisnatchor"] target: working: ["C"] + not_working: ["All"] diff --git a/modules/chrome_extensions/inject_beef/config.yaml b/modules/chrome_extensions/inject_beef/config.yaml index 73be08789..1eae050cc 100755 --- a/modules/chrome_extensions/inject_beef/config.yaml +++ b/modules/chrome_extensions/inject_beef/config.yaml @@ -8,3 +8,4 @@ beef: authors: ["Kos", "antisnatchor"] target: working: ["C"] + not_working: ["All"] diff --git a/modules/chrome_extensions/send_gvoice_sms/config.yaml b/modules/chrome_extensions/send_gvoice_sms/config.yaml index 59a0d83fe..b1e41e0f9 100755 --- a/modules/chrome_extensions/send_gvoice_sms/config.yaml +++ b/modules/chrome_extensions/send_gvoice_sms/config.yaml @@ -4,7 +4,8 @@ beef: enable: true category: "Chrome Extensions" name: "Send Gvoice SMS" - description: "Send a text message (SMS) through the Google Voice account of the victim, if she's logged in Google." + description: "Send a text message (SMS) through the Google Voice account of the victim, if she's logged in to Google." authors: ["Kos", "antisnatchor"] target: - user_notify: ["ALL"] + user_notify: ["C"] + not_working: ["ALL"] From a956bd60ea6db3df8f42ad91faf9ac5038f4ff5b Mon Sep 17 00:00:00 2001 From: bcoles Date: Thu, 5 Jan 2012 15:49:08 +1030 Subject: [PATCH 2/3] Added "Decoder" tab draft --- .../admin_ui/controllers/panel/index.html | 1 + .../media/javascript/ui/panel/DecoderTab.js | 164 ++++++++++++++++++ .../media/javascript/ui/panel/MainPanel.js | 8 + 3 files changed, 173 insertions(+) create mode 100644 extensions/admin_ui/media/javascript/ui/panel/DecoderTab.js diff --git a/extensions/admin_ui/controllers/panel/index.html b/extensions/admin_ui/controllers/panel/index.html index 896f77b92..2fb9574ee 100644 --- a/extensions/admin_ui/controllers/panel/index.html +++ b/extensions/admin_ui/controllers/panel/index.html @@ -38,6 +38,7 @@ <%= script_tag 'ui/panel/Logout.js' %> <%= script_tag 'ui/panel/WelcomeTab.js' %> + <%= script_tag 'ui/panel/DecoderTab.js' %> <%= stylesheet_tag 'ext-all.css' %> <%= stylesheet_tag 'base.css' %> diff --git a/extensions/admin_ui/media/javascript/ui/panel/DecoderTab.js b/extensions/admin_ui/media/javascript/ui/panel/DecoderTab.js new file mode 100644 index 000000000..a63b4d62e --- /dev/null +++ b/extensions/admin_ui/media/javascript/ui/panel/DecoderTab.js @@ -0,0 +1,164 @@ +// +// 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. +// +DecoderTab = function() { + + /* + * The panel used to encode/decode text. + ********************************************/ + var decoder_panel = new Ext.FormPanel({ + title: 'Decoder', + id: 'decoder-panel', + hideLabels : false, + border: false, + padding: '3px 5px 0 5px', + + items:[{ + fieldLabel: 'Text', + xtype: 'textarea', + id: 'inputText', + name: 'inputText', + width: '100%', + height: '40%', + allowBlank: true + },{ + fieldLabel: 'Result', + xtype: 'textarea', + id: 'resultText', + name: 'resultText', + width: '100%', + height: '40%', + allowBlank: true + }], + + buttons: [{ + text: 'Encode', + handler: function() { + var form = Ext.getCmp('decoder-panel').getForm(); + var form_values = form.getValues(); + var input_text = form_values['inputText']; + var result=""; + switch (form_values['decodeType']) { + case "base64": + break; + case "rot13": + result = input_text.replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);}); + break; + case "addslashes": + result = input_text.replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'); + break; + case "stripslashes": + result = input_text.replace(/\\(.?)/g, function (s, n1) {switch (n1) {case '\\':return '\\';case '0':return '\u0000';case '':return '';default:return n1;}}); + break; + case "reverse": + break; + case "escape": + result = escape(input_text); + break; + case "unescape": + result = unescape(input_text); + break; + case "encodeuri": + result = encodeURI(input_text); + break; + case "decodeuri": + result = decodeURI(input_text); + break; + default: + } + form.setValues({resultText: result}); + } + },{ + text: 'Decode', + handler: function() { + var form = Ext.getCmp('decoder-panel').getForm(); + var form_values = form.getValues(); + var input_text = form_values['inputText']; + var result=""; + switch (form_values['decodeType']) { + case "base64": + break; + case "rot13": + result = input_text.replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);}); + break; + case "addslashes": + result = input_text.replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'); + break; + case "stripslashes": + result = input_text.replace(/\\(.?)/g, function (s, n1) {switch (n1) {case '\\':return '\\';case '0':return '\u0000';case '':return '';default:return n1;}}); + break; + case "reverse": + break; + case "escape": + result = escape(input_text); + break; + case "unescape": + result = unescape(input_text); + break; + case "encodeuri": + result = encodeURI(input_text); + break; + case "decodeuri": + result = decodeURI(input_text); + break; + default: + } + form.setValues({resultText: result}); + } + }] + + }); + + decode_combo = new Ext.form.ComboBox({ + name: 'decodeType', + disableKeyFilter: false, + fieldLabel: 'Type', + forceSelection: true, + emptyText: '--select--', + triggerAction: 'all', + mode: 'local', + store: new Ext.data.SimpleStore({ + id: 0, + fields: ['value', 'text'], + data: [ + //['base64', 'Base64'], + //['reverse', 'Reverse'], + ['rot13', 'Rot13'], + //['fromcharcode', 'String.fromCharCode'], + ['addslashes', 'Add Slashes'], + ['stripslashes', 'Strip Slashes'], + ['escape', 'escape()'], + ['unescape', 'unescape()'], + ['encodeuri', 'encodeURI()'], + ['decodeuri', 'decodeURI()'] + ] + }), + valueField: 'value', + displayField: 'text', + hiddenName: 'decodeType' + }); + + decoder_panel.add(decode_combo); + + DecoderTab.superclass.constructor.call(this, { + region: 'center', + items: [decoder_panel], + autoScroll: true, + border: false + }); + +}; + +Ext.extend(DecoderTab,Ext.Panel, {}); diff --git a/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js b/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js index 84a0ecd70..fcfae4aa5 100644 --- a/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js +++ b/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js @@ -41,6 +41,7 @@ MainPanel = function(){ this.grid = new DataGrid('/ui/logs/all.json',30); this.grid.border = false; this.welcome_tab = new WelcomeTab; + this.decoder_tab = new DecoderTab; MainPanel.superclass.constructor.call(this, { id:'main-tabs', @@ -69,6 +70,13 @@ MainPanel = function(){ hideMode:'offsets', items:[ this.grid + ]},{ + id:'decoder-view', + layout:'border', + title:'Decoder', + hideMode:'offsets', + items:[ + this.decoder_tab ] }] }); From a5c6179e10d11df84f1b18106751322020b2ca3a Mon Sep 17 00:00:00 2001 From: Saafan Date: Thu, 5 Jan 2012 16:14:51 +0200 Subject: [PATCH 3/3] Cleans up rake output for MSFIntegration Unit tests. Fixes issue 28 --- extensions/metasploit/rpcclient.rb | 6 +++++- test/unit/extensions/tc_metasploit.rb | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/extensions/metasploit/rpcclient.rb b/extensions/metasploit/rpcclient.rb index 80e2d2f5b..aa2df4305 100644 --- a/extensions/metasploit/rpcclient.rb +++ b/extensions/metasploit/rpcclient.rb @@ -34,6 +34,7 @@ module Metasploit @lock = false @lastauth = nil + @unit_test = false opts = { :host => @config['host'] || '127.0.0.1', :port => @config['port'] || 55552, @@ -63,6 +64,9 @@ module Metasploit ret end + def unit_test_init + @unit_test = true + end # login into metasploit def login get_lock() @@ -74,7 +78,7 @@ module Metasploit return false end - print_info 'Successful connection with Metasploit.' if not @lastauth + print_info 'Successful connection with Metasploit.' if (!@lastauth && !@unit_test) @lastauth = Time.now diff --git a/test/unit/extensions/tc_metasploit.rb b/test/unit/extensions/tc_metasploit.rb index 6c9baf310..f0478f35b 100644 --- a/test/unit/extensions/tc_metasploit.rb +++ b/test/unit/extensions/tc_metasploit.rb @@ -20,7 +20,7 @@ class TC_Metasploit < Test::Unit::TestCase def setup $root_dir="../../" - $:.unshift File.join( %w{ ../../ } ) + $:.unshift File.join( %w{ ../../ } ) end # @@ -45,6 +45,7 @@ class TC_Metasploit < Test::Unit::TestCase load_config require 'extensions/metasploit/extension.rb' @api = BeEF::Extension::Metasploit::RpcClient.instance + @api.unit_test_init() end # @@ -73,7 +74,7 @@ class TC_Metasploit < Test::Unit::TestCase # Verify that the login is working # def test_login - new_api + new_api assert(@api.login) end