|
|
@ -92,173 +92,222 @@ var wappalyzer = wappalyzer || (function() {
|
|
|
|
analyze: function(hostname, url, data) {
|
|
|
|
analyze: function(hostname, url, data) {
|
|
|
|
w.log('w.analyze');
|
|
|
|
w.log('w.analyze');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.url = url;
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.apps == null || w.categories == null ) {
|
|
|
|
if ( w.apps == null || w.categories == null ) {
|
|
|
|
w.log('apps.json not loaded');
|
|
|
|
w.log('apps.json not loaded');
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var i, app, type, regex, match, content, meta, header, apps = [];
|
|
|
|
if ( w.detected[url] == null ) {
|
|
|
|
|
|
|
|
w.detected[url] = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.detected[url] == null ) { w.detected[url] = []; }
|
|
|
|
var
|
|
|
|
|
|
|
|
i, app, type, regex, match, content, meta, header,
|
|
|
|
|
|
|
|
profiler = {
|
|
|
|
|
|
|
|
regexCount: 0,
|
|
|
|
|
|
|
|
startTime: ( new Date ).getTime()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
apps = []
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( app in w.apps ) {
|
|
|
|
|
|
|
|
// Skip if the app has already been detected
|
|
|
|
|
|
|
|
if ( w.detected[url].indexOf(app) !== -1 || apps.indexOf(app) !== -1 ) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( data ) {
|
|
|
|
next:
|
|
|
|
for ( app in w.apps ) {
|
|
|
|
|
|
|
|
for ( type in w.apps[app] ) {
|
|
|
|
|
|
|
|
// Skip if the app has already been detected
|
|
|
|
|
|
|
|
if ( w.detected[url].indexOf(app) !== -1 || apps.indexOf(app) !== -1 ) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ( type ) {
|
|
|
|
for ( type in w.apps[app] ) {
|
|
|
|
case 'url':
|
|
|
|
if ( data[type] == null ) {
|
|
|
|
regex = new RegExp(w.apps[app][type], 'i');
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( regex.test(url) ) { apps.push(app); }
|
|
|
|
switch ( type ) {
|
|
|
|
|
|
|
|
case 'url':
|
|
|
|
|
|
|
|
regex = new RegExp(w.apps[app][type], 'i');
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
profiler.regexCount ++;
|
|
|
|
case 'html':
|
|
|
|
|
|
|
|
if ( data[type] == null ) { break; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regex = new RegExp(w.apps[app][type], 'i');
|
|
|
|
if ( regex.test(url) ) {
|
|
|
|
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
if ( regex.test(data[type]) ) { apps.push(app); }
|
|
|
|
break next;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'html':
|
|
|
|
|
|
|
|
regex = new RegExp(w.apps[app][type], 'i');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
profiler.regexCount ++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( regex.test(data[type]) ) {
|
|
|
|
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break next;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'script':
|
|
|
|
|
|
|
|
if ( data['html'] == null ) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'script':
|
|
|
|
}
|
|
|
|
if ( data['html'] == null ) { break; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regex = /<script[^>]+src=("|')([^"']+)\1/ig;
|
|
|
|
regex = new RegExp(w.apps[app][type], 'i');
|
|
|
|
|
|
|
|
|
|
|
|
while ( match = regex.exec(data['html']) ) {
|
|
|
|
profiler.regexCount ++;
|
|
|
|
if ( w.apps[app][type].test(match[2]) ) {
|
|
|
|
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
while ( match = new RegExp('<script[^>]+src=("|\')([^"\']+)\1', 'ig').exec(data['html']) ) {
|
|
|
|
}
|
|
|
|
profiler.regexCount ++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( regex.test(match[2]) ) {
|
|
|
|
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'meta':
|
|
|
|
|
|
|
|
if ( data['html'] == null ) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'meta':
|
|
|
|
}
|
|
|
|
if ( data['html'] == null ) { break; }
|
|
|
|
|
|
|
|
|
|
|
|
profiler.regexCount ++;
|
|
|
|
|
|
|
|
|
|
|
|
regex = /<meta[^>]+>/ig;
|
|
|
|
while ( match = new RegExp('<meta[^>]+>', 'ig').exec(data['html']) ) {
|
|
|
|
|
|
|
|
for ( meta in w.apps[app][type] ) {
|
|
|
|
|
|
|
|
profiler.regexCount ++;
|
|
|
|
|
|
|
|
|
|
|
|
while ( match = regex.exec(data['html']) ) {
|
|
|
|
if ( new RegExp('name=["\']' + meta + '["\']', 'i').test(match) ) {
|
|
|
|
for ( meta in w.apps[app][type] ) {
|
|
|
|
content = match.toString().match(/content=("|')([^"']+)("|')/i);
|
|
|
|
if ( new RegExp('name=["\']' + meta + '["\']', 'i').test(match) ) {
|
|
|
|
|
|
|
|
content = match.toString().match(/content=("|')([^"']+)("|')/i);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( content && content.length == 4 && w.apps[app].meta[meta].test(content[2]) ) {
|
|
|
|
regex = new RegExp(w.apps[app].meta[meta], 'i');
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
profiler.regexCount ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( content && content.length === 4 && regex.test(content[2]) ) {
|
|
|
|
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'headers':
|
|
|
|
|
|
|
|
if ( data[type] == null ) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'headers':
|
|
|
|
}
|
|
|
|
if ( data[type] == null ) { break; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( header in w.apps[app].headers ) {
|
|
|
|
for ( header in w.apps[app].headers ) {
|
|
|
|
regex = new RegExp(w.apps[app][type][header], 'i');
|
|
|
|
regex = new RegExp(w.apps[app][type][header], 'i');
|
|
|
|
|
|
|
|
|
|
|
|
if ( data[type][header] != null && regex.test(data[type][header]) ) {
|
|
|
|
profiler.regexCount ++;
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
if ( data[type][header] != null && regex.test(data[type][header]) ) {
|
|
|
|
}
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'env':
|
|
|
|
|
|
|
|
if ( data[type] == null ) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'env':
|
|
|
|
}
|
|
|
|
if ( data[type] == null ) { break; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regex = RegExp(w.apps[app][type], 'i');
|
|
|
|
regex = RegExp(w.apps[app][type], 'i');
|
|
|
|
|
|
|
|
|
|
|
|
for ( i in data[type] ) {
|
|
|
|
for ( i in data[type] ) {
|
|
|
|
if ( regex.test(data[type][i]) ) {
|
|
|
|
profiler.regexCount ++;
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
if ( regex.test(data[type][i]) ) {
|
|
|
|
}
|
|
|
|
apps.push(app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Implied applications
|
|
|
|
w.log('Tested ' + profiler.regexCount + ' regular expressions in ' + ( ( ( new Date ).getTime() - profiler.startTime ) / 1000 ) + 's');
|
|
|
|
var i, j, k, implied;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( i = 0; i < 3; i ++ ) {
|
|
|
|
// Implied applications
|
|
|
|
for ( j in apps ) {
|
|
|
|
var i, j, k, implied;
|
|
|
|
if ( w.apps[apps[j]] && w.apps[apps[j]].implies ) {
|
|
|
|
|
|
|
|
for ( k in w.apps[apps[j]].implies ) {
|
|
|
|
|
|
|
|
implied = w.apps[apps[j]].implies[k];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( !w.apps[implied] ) {
|
|
|
|
for ( i = 0; i < 3; i ++ ) {
|
|
|
|
w.log('Implied application ' + implied + ' does not exist');
|
|
|
|
for ( j in apps ) {
|
|
|
|
|
|
|
|
if ( w.apps[apps[j]] && w.apps[apps[j]].implies ) {
|
|
|
|
|
|
|
|
for ( k in w.apps[apps[j]].implies ) {
|
|
|
|
|
|
|
|
implied = w.apps[apps[j]].implies[k];
|
|
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
if ( !w.apps[implied] ) {
|
|
|
|
}
|
|
|
|
w.log('Implied application ' + implied + ' does not exist');
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.detected[url].indexOf(implied) === -1 && apps.indexOf(implied) === -1 ) {
|
|
|
|
continue;
|
|
|
|
apps.push(implied);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.detected[url].indexOf(implied) === -1 && apps.indexOf(implied) === -1 ) {
|
|
|
|
|
|
|
|
apps.push(implied);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
w.log(apps.length + ' apps detected: ' + apps.join(', '));
|
|
|
|
w.log(apps.length + ' apps detected: ' + apps.join(', '));
|
|
|
|
|
|
|
|
|
|
|
|
// Keep history of detected apps
|
|
|
|
|
|
|
|
var i, app, match;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( i in apps ) {
|
|
|
|
// Keep history of detected apps
|
|
|
|
app = apps[i];
|
|
|
|
var i, app, match;
|
|
|
|
|
|
|
|
|
|
|
|
// Per hostname
|
|
|
|
for ( i in apps ) {
|
|
|
|
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
|
|
|
|
app = apps[i];
|
|
|
|
if ( typeof w.ping.hostnames === 'undefined' ) {
|
|
|
|
|
|
|
|
w.ping.hostnames = {};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
|
|
|
|
// Per hostname
|
|
|
|
w.ping.hostnames[hostname] = { applications: {}, meta: {} };
|
|
|
|
if ( /^[a-z0-9._\-]+\.[a-z]+/.test(hostname) && !/(dev\.|\/admin|\.local)/.test(url) ) {
|
|
|
|
}
|
|
|
|
if ( typeof w.ping.hostnames === 'undefined' ) {
|
|
|
|
|
|
|
|
w.ping.hostnames = {};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
|
|
|
|
if ( typeof w.ping.hostnames[hostname] === 'undefined' ) {
|
|
|
|
w.ping.hostnames[hostname].applications[app] = 1;
|
|
|
|
w.ping.hostnames[hostname] = { applications: {}, meta: {} };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
w.ping.hostnames[hostname].applications[app] ++;
|
|
|
|
if ( typeof w.ping.hostnames[hostname].applications[app] === 'undefined' ) {
|
|
|
|
|
|
|
|
w.ping.hostnames[hostname].applications[app] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Per URL
|
|
|
|
w.ping.hostnames[hostname].applications[app] ++;
|
|
|
|
if ( w.detected[url].indexOf(app) === -1 ) { w.detected[url].push(app); }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Additional information
|
|
|
|
// Per URL
|
|
|
|
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
|
|
|
|
if ( w.detected[url].indexOf(app) === -1 ) { w.detected[url].push(app); }
|
|
|
|
if ( data.html != null ) {
|
|
|
|
}
|
|
|
|
match = data.html.match(/<html[^>]*[: ]lang="([^"]+)"/);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( match != null && match.length ) {
|
|
|
|
// Additional information
|
|
|
|
w.ping.hostnames[hostname].meta['language'] = match[1];
|
|
|
|
if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) {
|
|
|
|
}
|
|
|
|
if ( data.html != null ) {
|
|
|
|
|
|
|
|
match = data.html.match(/<html[^>]*[: ]lang="([^"]+)"/);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( match != null && match.length ) {
|
|
|
|
|
|
|
|
w.ping.hostnames[hostname].meta['language'] = match[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
|
|
|
|
if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); }
|
|
|
|
|
|
|
|
|
|
|
|
apps = null;
|
|
|
|
apps = null;
|
|
|
|
data = null;
|
|
|
|
data = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
driver('displayApps');
|
|
|
|
driver('displayApps');
|
|
|
|
}
|
|
|
|
}
|
|
|
|