From 15a502bce6bd88287f68c816299a5919181f87e8 Mon Sep 17 00:00:00 2001 From: bcoles Date: Sun, 3 Feb 2013 03:39:30 +1030 Subject: [PATCH] Add CPU type to browser initialization Add support for Firefox 19 --- core/main/client/browser.js | 22 ++++++++++++++----- core/main/handlers/browserdetails.rb | 8 +++++++ .../admin_ui/controllers/modules/modules.rb | 15 +++++++++++++ extensions/console/lib/shellinterface.rb | 15 +++++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/core/main/client/browser.js b/core/main/client/browser.js index f8741ad3b..34701d3ab 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -220,12 +220,20 @@ beef.browser = { return !!window.devicePixelRatio && !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/18\./) != null; }, + /** + * Returns true if FF19 + * @example: beef.browser.isFF19() + */ + isFF19: function() { +return !!window.devicePixelRatio && !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/19\./) != null; + }, + /** * Returns true if FF. * @example: beef.browser.isFF() */ isFF: function() { - return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() || this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18(); + return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() || this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18() || this.isFF19(); }, /** @@ -526,6 +534,7 @@ beef.browser = { FF16: this.isFF16(), // Firefox 16 FF17: this.isFF17(), // Firefox 17 FF18: this.isFF18(), // Firefox 18 + FF19: this.isFF19(), // Firefox 19 FF: this.isFF(), // Firefox any version IE6: this.isIE6(), // Internet Explorer 6 @@ -597,6 +606,7 @@ beef.browser = { if (this.isFF16()) { return '16' }; // Firefox 16 if (this.isFF17()) { return '17' }; // Firefox 17 if (this.isFF18()) { return '18' }; // Firefox 18 + if (this.isFF19()) { return '19' }; // Firefox 19 if (this.isIE6()) { return '6' }; // Internet Explorer 6 if (this.isIE7()) { return '7' }; // Internet Explorer 7 @@ -606,7 +616,7 @@ beef.browser = { if (this.isS4()) { return '4' }; // Safari 4 if (this.isS5()) { return '5' }; // Safari 5 - if (this.isS6()) { return '6' }; // Safari 5 + if (this.isS6()) { return '6' }; // Safari 6 if (this.isO9_52()) { return '9.5'}; // Opera 9.5x if (this.isO9_60()) { return '9.6'}; // Opera 9.6 @@ -630,7 +640,7 @@ beef.browser = { if (this.isIE()) { return 'IE'}; // Internet Explorer any version if (this.isO()) { return 'O' }; // Opera any version if (this.isS()) { return 'S' }; // Safari any version - return 'UN'; // Unknown UA + return 'UNKNOWN'; // Unknown UA }, /** @@ -957,15 +967,16 @@ beef.browser = { var browser_version = beef.browser.getBrowserVersion(); var browser_reported_name = beef.browser.getBrowserReportedName(); var cookies = document.cookie; - var page_title = (document.title) ? document.title : "No Title"; + var page_title = (document.title) ? document.title : ""; var page_uri = document.location.href; - var page_referrer = (document.referrer) ? document.referrer : "No Referrer"; + var page_referrer = (document.referrer) ? document.referrer : ""; var hostname = document.location.hostname; var hostport = (document.location.port)? document.location.port : "80"; var browser_plugins = beef.browser.getPlugins(); var date_stamp = new Date().toString(); var os_name = beef.os.getName(); var hw_name = beef.hardware.getName(); + var cpu_type = beef.hardware.cpuType(); var system_platform = (typeof(navigator.platform) != "undefined" && navigator.platform != "") ? navigator.platform : null; var browser_type = JSON.stringify(beef.browser.type(), function (key, value) {if (value == true) return value; else if (typeof value == 'object') return value; else return;}); var screen_size = beef.browser.getScreenSize(); @@ -992,6 +1003,7 @@ beef.browser = { if(browser_plugins) details["BrowserPlugins"] = browser_plugins; if(os_name) details['OsName'] = os_name; if(hw_name) details['Hardware'] = hw_name; + if(cpu_type) details['CPU'] = cpu_type; if(date_stamp) details['DateStamp'] = date_stamp; if(system_platform) details['SystemPlatform'] = system_platform; if(browser_type) details['BrowserType'] = browser_type; diff --git a/core/main/handlers/browserdetails.rb b/core/main/handlers/browserdetails.rb index bed9b43c8..3ac0b3409 100644 --- a/core/main/handlers/browserdetails.rb +++ b/core/main/handlers/browserdetails.rb @@ -255,6 +255,14 @@ module BeEF self.err_msg "Invalid value for HasActiveX returned from the hook browser's initial connection." end + # get and store the value for CPU + cpu_type = get_param(@data['results'], 'CPU') + if !cpu_type.nil? + BD.set(session_id, 'CPU', cpu_type) + else + self.err_msg "Invalid value for CPU returned from the hook browser's initial connection." + end + # get and store whether the browser has session cookies enabled has_session_cookies = get_param(@data['results'], 'hasSessionCookies') if BeEF::Filters.is_valid_yes_no?(has_session_cookies) diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index e4857e87a..2a3daa27d 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -408,6 +408,21 @@ class Modules < BeEF::Extension::AdminUI::HttpController summary_grid_hash['results'].push(page_name_row) # add the row end + # set and add the value for CPU + cpu_type = BD.get(zombie_session, 'CPU') + if not cpu_type.nil? + encoded_cpu_type = CGI.escapeHTML(cpu_type) + encoded_cpu_type_hash = { 'CPU' => encoded_cpu_type } + + page_name_row = { + 'category' => 'Host', + 'data' => encoded_cpu_type_hash, + 'from' => 'Initialization' + } + + summary_grid_hash['results'].push(page_name_row) # add the row + end + # set and add the return values for hasSessionCookies has_session_cookies = BD.get(zombie_session, 'hasSessionCookies') if not has_session_cookies.nil? diff --git a/extensions/console/lib/shellinterface.rb b/extensions/console/lib/shellinterface.rb index a13e74013..a84f7022a 100644 --- a/extensions/console/lib/shellinterface.rb +++ b/extensions/console/lib/shellinterface.rb @@ -617,6 +617,21 @@ class ShellInterface summary_grid_hash['results'].push(page_name_row) # add the row end + # set and add the value for CPU + cpu_type = BD.get(zombie_session, 'CPU') + if not cpu_type.nil? + encoded_cpu_type = CGI.escapeHTML(cpu_type) + encoded_cpu_type_hash = { 'CPU' => encoded_cpu_type } + + page_name_row = { + 'category' => 'Host', + 'data' => encoded_cpu_type_hash, + 'from' => 'Initialization' + } + + summary_grid_hash['results'].push(page_name_row) # add the row + end + # set and add the return values for hasSessionCookies has_session_cookies = BD.get(self.targetsession, 'hasSessionCookies') if not has_session_cookies.nil?