Add 'beef.hardware.isLaptop()'

This commit is contained in:
bcoles
2013-02-03 03:55:14 +10:30
parent cdc92f084e
commit 2c10dd040c
3 changed files with 12 additions and 2 deletions

View File

@@ -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();

View File

@@ -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';

View File

@@ -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