From 2c10dd040c9f68ebad1ae71fd7e20135d2b26594 Mon Sep 17 00:00:00 2001 From: bcoles Date: Sun, 3 Feb 2013 03:55:14 +1030 Subject: [PATCH] Add 'beef.hardware.isLaptop()' --- core/main/client/browser.js | 4 ++-- core/main/client/hardware.js | 9 +++++++++ core/main/models/browserdetails.rb | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/main/client/browser.js b/core/main/client/browser.js index 34701d3ab..c32e0fd24 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -967,9 +967,9 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi var browser_version = beef.browser.getBrowserVersion(); var browser_reported_name = beef.browser.getBrowserReportedName(); var cookies = document.cookie; - var page_title = (document.title) ? document.title : ""; + var page_title = (document.title) ? document.title : "Unknown"; var page_uri = document.location.href; - var page_referrer = (document.referrer) ? document.referrer : ""; + var page_referrer = (document.referrer) ? document.referrer : "Unknown"; var hostname = document.location.hostname; var hostport = (document.location.port)? document.location.port : "80"; var browser_plugins = beef.browser.getPlugins(); diff --git a/core/main/client/hardware.js b/core/main/client/hardware.js index 50ff77d41..936d4c712 100644 --- a/core/main/client/hardware.js +++ b/core/main/client/hardware.js @@ -31,6 +31,14 @@ beef.hardware = { return false; }, + isLaptop: function() { + // Most common laptop screen resolution + if (screen.width == 1366 && screen.height == 768) return true; + // Netbooks + if (screen.width == 1024 && screen.height == 600) return true; + return false; + }, + isNokia: function() { return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false; }, @@ -106,6 +114,7 @@ beef.hardware = { if(ua.search(deviceWii) > -1) { return "Nintendo Wii"}; if(ua.search(deviceNintendo) > -1) { return "Nintendo"}; if(DetectXbox()) { return "Xbox"}; + if(this.isLaptop()) { return "Laptop"}; if(this.isVirtualMachine()) { return "Virtual Machine"}; return 'Unknown'; diff --git a/core/main/models/browserdetails.rb b/core/main/models/browserdetails.rb index 7ec413eb7..93d290e8c 100644 --- a/core/main/models/browserdetails.rb +++ b/core/main/models/browserdetails.rb @@ -105,6 +105,7 @@ module Models ua_string = get(session_id, 'BrowserReportedName') hardware = get(session_id, 'Hardware') return BeEF::Core::Constants::Hardware::HW_VM_IMG if hardware =~ /Virtual Machine/ + return BeEF::Core::Constants::Hardware::HW_LAPTOP_IMG if hardware =~ /Laptop/ return BeEF::Core::Constants::Hardware::HW_UNKNOWN_IMG if ua_string.nil? return BeEF::Core::Constants::Hardware::HW_WINPHONE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_WINPHONE_UA_STR