Add 'beef.os.getDefaultBrowser'
This commit is contained in:
@@ -1841,6 +1841,7 @@ beef.browser = {
|
||||
var browser_plugins = beef.browser.getPlugins();
|
||||
var date_stamp = new Date().toString();
|
||||
var os_name = beef.os.getName();
|
||||
var default_browser = beef.os.getDefaultBrowser();
|
||||
var hw_name = beef.hardware.getName();
|
||||
var cpu_type = beef.hardware.cpuType();
|
||||
var touch_enabled = (beef.hardware.isTouchEnabled()) ? "Yes" : "No";
|
||||
@@ -1888,6 +1889,7 @@ beef.browser = {
|
||||
if (hostport) details['HostPort'] = hostport;
|
||||
if (browser_plugins) details['BrowserPlugins'] = browser_plugins;
|
||||
if (os_name) details['OsName'] = os_name;
|
||||
if (default_browser) details['DefaultBrowser'] = default_browser;
|
||||
if (hw_name) details['Hardware'] = hw_name;
|
||||
if (cpu_type) details['CPU'] = cpu_type;
|
||||
if (touch_enabled) details['TouchEnabled'] = touch_enabled;
|
||||
|
||||
@@ -8,6 +8,24 @@ beef.os = {
|
||||
|
||||
ua: navigator.userAgent,
|
||||
|
||||
/**
|
||||
* Detect default browser (IE only)
|
||||
* Written by unsticky
|
||||
* http://ha.ckers.org/blog/20070319/detecting-default-browser-in-ie/
|
||||
*/
|
||||
getDefaultBrowser: function() {
|
||||
var mt = document.mimeType;
|
||||
var result = "Unknown"
|
||||
if (mt) {
|
||||
if (mt == "Safari Document") result = "Safari";
|
||||
if (mt == "Firefox HTML Document") result = "Firefox";
|
||||
if (mt == "Chrome HTML Document") result = "Chrome";
|
||||
if (mt == "HTML Document") result = "Internet Explorer";
|
||||
if (mt == "Opera Web Document") result = "Opera";
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
isWin311: function() {
|
||||
return (this.ua.match('(Win16)')) ? true : false;
|
||||
},
|
||||
|
||||
@@ -166,6 +166,10 @@ module BeEF
|
||||
self.err_msg "Invalid operating system name returned from the hook browser's initial connection."
|
||||
end
|
||||
|
||||
# get and store default browser
|
||||
default_browser = get_param(@data['results'], 'DefaultBrowser')
|
||||
BD.set(session_id, 'DefaultBrowser', default_browser)
|
||||
|
||||
# get and store the hardware name
|
||||
hw_name = get_param(@data['results'], 'Hardware')
|
||||
if BeEF::Filters.is_valid_hwname?(hw_name)
|
||||
|
||||
@@ -104,6 +104,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController
|
||||
['Host', 'Operating System', 'OsName'],
|
||||
['Host', 'Hardware', 'Hardware'],
|
||||
['Host', 'CPU', 'CPU'],
|
||||
['Host', 'Default Browser', 'DefaultBrowser'],
|
||||
['Host', 'Screen Size', 'ScreenSize'],
|
||||
['Host', 'Touch Screen', 'TouchEnabled']
|
||||
]
|
||||
|
||||
@@ -320,6 +320,7 @@ class ShellInterface
|
||||
['Host', 'Operating System', 'OsName'],
|
||||
['Host', 'Hardware', 'Hardware'],
|
||||
['Host', 'CPU', 'CPU'],
|
||||
['Host', 'Default Browser', 'DefaultBrowser'],
|
||||
['Host', 'Screen Size', 'ScreenSize'],
|
||||
['Host', 'Touch Screen', 'TouchEnabled']
|
||||
]
|
||||
|
||||
@@ -3,25 +3,9 @@
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
// Written by unsticky
|
||||
// For more information see http://ha.ckers.org/blog/20070319/detecting-default-browser-in-ie/
|
||||
|
||||
beef.execute(function() {
|
||||
|
||||
var mt = document.mimeType;
|
||||
|
||||
if (mt) {
|
||||
if (mt == "Safari Document") result = "Safari";
|
||||
if (mt == "Firefox HTML Document") result = "Firefox";
|
||||
if (mt == "Chrome HTML Document") result = "Chrome";
|
||||
if (mt == "HTML Document") result = "Internet Explorer";
|
||||
if (mt == "Opera Web Document") result = "Opera";
|
||||
} else {
|
||||
result = "Unknown";
|
||||
}
|
||||
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "browser="+result);
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "browser="+beef.os.getDefaultBrowser());
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user