Add getCpuCores getCpuDetails getMemory getBatteryDetails
This commit is contained in:
@@ -4028,7 +4028,8 @@ beef.browser = {
|
||||
var os_version = beef.os.getVersion();
|
||||
var default_browser = beef.os.getDefaultBrowser();
|
||||
var hw_name = beef.hardware.getName();
|
||||
var cpu_type = beef.hardware.getCpuType();
|
||||
var cpu_arch = beef.hardware.getCpuArch();
|
||||
var cpu_cores = beef.hardware.getCpuCores();
|
||||
var touch_enabled = (beef.hardware.isTouchEnabled()) ? "Yes" : "No";
|
||||
var browser_platform = (typeof(navigator.platform) != "undefined" && navigator.platform != "") ? navigator.platform : 'Unknown';
|
||||
var browser_type = JSON.stringify(beef.browser.type(), function (key, value) {
|
||||
@@ -4074,7 +4075,8 @@ beef.browser = {
|
||||
if (os_version) details['OsVersion'] = os_version;
|
||||
if (default_browser) details['DefaultBrowser'] = default_browser;
|
||||
if (hw_name) details['Hardware'] = hw_name;
|
||||
if (cpu_type) details['CPU'] = cpu_type;
|
||||
if (cpu_arch) details['CpuArch'] = cpu_arch;
|
||||
if (cpu_cores) details['CpuCores'] = cpu_cores;
|
||||
if (touch_enabled) details['TouchEnabled'] = touch_enabled;
|
||||
if (date_stamp) details['DateStamp'] = date_stamp;
|
||||
if (browser_platform) details['BrowserPlatform'] = browser_platform;
|
||||
|
||||
@@ -11,7 +11,7 @@ beef.hardware = {
|
||||
/*
|
||||
* @return: {String} CPU type
|
||||
**/
|
||||
getCpuType: function() {
|
||||
getCpuArch: function() {
|
||||
var arch = 'UNKNOWN';
|
||||
// note that actually WOW64 means IE 32bit and Windows 64 bit. we are more interested
|
||||
// in detecting the OS arch rather than the browser build
|
||||
@@ -37,6 +37,69 @@ beef.hardware = {
|
||||
return arch;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns number of CPU cores
|
||||
**/
|
||||
getCpuCores: function() {
|
||||
var cores = 'unknown';
|
||||
try {
|
||||
if(typeof navigator.hardwareConcurrency != 'undefined') {
|
||||
cores = navigator.hardwareConcurrency;
|
||||
}
|
||||
} catch(e) {
|
||||
cores = 'unknown';
|
||||
}
|
||||
return cores;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns CPU details
|
||||
**/
|
||||
getCpuDetails: function() {
|
||||
return {
|
||||
arch: beef.hardware.getCpuArch(),
|
||||
cores: beef.hardware.getCpuCores()
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns RAM (GiB)
|
||||
**/
|
||||
getMemory: function() {
|
||||
var memory = 'unknown';
|
||||
try {
|
||||
if(typeof navigator.deviceMemory != 'undefined') {
|
||||
memory = navigator.deviceMemory;
|
||||
}
|
||||
} catch(e) {
|
||||
memory = 'unknown';
|
||||
}
|
||||
return memory;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns battery details
|
||||
**/
|
||||
getBatteryDetails: function() {
|
||||
var battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery;
|
||||
|
||||
if (!!battery) {
|
||||
return {
|
||||
chargingStatus: battery.charging,
|
||||
batteryLevel: battery.level * 100 + "%",
|
||||
chargingTime: battery.chargingTime,
|
||||
dischargingTime: battery.dischargingTime
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
chargingStatus: 'unknown',
|
||||
batteryLevel: 'unknown',
|
||||
chargingTime: 'unknown',
|
||||
dischargingTime: 'unknown'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns zombie screen size and color depth.
|
||||
*/
|
||||
|
||||
@@ -333,12 +333,20 @@ module BeEF
|
||||
end
|
||||
end
|
||||
|
||||
# get and store the value for CPU
|
||||
cpu_type = get_param(@data['results'], 'CPU')
|
||||
if BeEF::Filters.is_valid_cpu?(cpu_type)
|
||||
BD.set(session_id, 'CPU', cpu_type)
|
||||
# get and store the value for CpuArch
|
||||
cpu_arch = get_param(@data['results'], 'CpuArch')
|
||||
if BeEF::Filters.is_valid_cpu?(cpu_arch)
|
||||
BD.set(session_id, 'CpuArch', cpu_arch)
|
||||
else
|
||||
self.err_msg "Invalid value for CPU returned from the hook browser's initial connection."
|
||||
self.err_msg "Invalid value for CpuArch returned from the hook browser's initial connection."
|
||||
end
|
||||
|
||||
# get and store the value for CpuCores
|
||||
cpu_cores = get_param(@data['results'], 'CpuCores')
|
||||
if BeEF::Filters.alphanums_only?(cpu_cores)
|
||||
BD.set(session_id, 'CpuCores', cpu_cores)
|
||||
else
|
||||
self.err_msg "Invalid value for CpuCores returned from the hook browser's initial connection."
|
||||
end
|
||||
|
||||
# get and store the value for TouchEnabled
|
||||
|
||||
@@ -123,7 +123,8 @@ class Modules < BeEF::Extension::AdminUI::HttpController
|
||||
['Host', 'Date', 'DateStamp'],
|
||||
['Host', 'Operating System', 'OsName'],
|
||||
['Host', 'Hardware', 'Hardware'],
|
||||
['Host', 'CPU', 'CPU'],
|
||||
['Host', 'CPU Arch', 'CpuArch'],
|
||||
['Host', 'CPU Cores', 'CpuCores'],
|
||||
['Host', 'Default Browser', 'DefaultBrowser'],
|
||||
['Host', 'Screen Size', 'ScreenSize'],
|
||||
['Host', 'Touch Screen', 'TouchEnabled']
|
||||
|
||||
@@ -36,7 +36,7 @@ var ZombiesMgr = function(zombies_tree_lists) {
|
||||
text+= ip;
|
||||
|
||||
balloon_text = "IP: " + ip;
|
||||
balloon_text+= "<br/>Origin: " + domain + ":" + port;
|
||||
balloon_text+= "<hr/>Origin: " + domain + ":" + port;
|
||||
balloon_text+= "<hr/>Browser: " + browser_name + " " + browser_version;
|
||||
balloon_text+= "<br/>System: " + os_name;
|
||||
balloon_text+= "<br/>Hardware: " + hw_name;
|
||||
|
||||
Reference in New Issue
Block a user