diff --git a/modules/browser/detect_unity/command.js b/modules/browser/detect_unity/command.js new file mode 100644 index 000000000..f1bd4316a --- /dev/null +++ b/modules/browser/detect_unity/command.js @@ -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"); + + } + +}); \ No newline at end of file diff --git a/modules/browser/detect_unity/config.yaml b/modules/browser/detect_unity/config.yaml new file mode 100644 index 000000000..c3ae04811 --- /dev/null +++ b/modules/browser/detect_unity/config.yaml @@ -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_unity: + enable: true + category: "Browser" + name: "Detect Unity Web Player" + description: "Detects Unity Web Player." + authors: ["gcattani"] + target: + working: ["All"] diff --git a/modules/browser/detect_unity/module.rb b/modules/browser/detect_unity/module.rb new file mode 100644 index 000000000..a1ea185dc --- /dev/null +++ b/modules/browser/detect_unity/module.rb @@ -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_unity < BeEF::Core::Command + + def post_execute + content = {} + content['unity'] = @datastore['unity'] + save content + end + +end \ No newline at end of file