Add resilience for cases where Array has been extended (#2287)

main
Patrick Meenan 7 years ago committed by Elbert Alias
parent 49b3db1d8d
commit 98f8691b70

@ -92,7 +92,9 @@ class Wappalyzer {
if ( data.js ) { if ( data.js ) {
Object.keys(data.js).forEach(appName => { Object.keys(data.js).forEach(appName => {
if (typeof data.js[appName] != 'function') {
promises.push(this.analyzeJs(apps[appName], data.js[appName])); promises.push(this.analyzeJs(apps[appName], data.js[appName]));
}
}); });
} }
@ -296,7 +298,7 @@ class Wappalyzer {
// Remove excluded applications // Remove excluded applications
Object.keys(apps).forEach(appName => { Object.keys(apps).forEach(appName => {
if ( excludes.indexOf(appName) !== -1 ) { if ( excludes.indexOf(appName) > -1 ) {
delete apps[appName]; delete apps[appName];
} }
}) })
@ -495,6 +497,7 @@ class Wappalyzer {
const promises = []; const promises = [];
Object.keys(patterns).forEach(headerName => { Object.keys(patterns).forEach(headerName => {
if (typeof patterns[headerName] != 'function') {
promises.push(this.asyncForEach(patterns[headerName], pattern => { promises.push(this.asyncForEach(patterns[headerName], pattern => {
headerName = headerName.toLowerCase(); headerName = headerName.toLowerCase();
@ -506,6 +509,7 @@ class Wappalyzer {
}); });
} }
})); }));
}
}); });
return promises ? Promise.all(promises) : Promise.resolve(); return promises ? Promise.all(promises) : Promise.resolve();
@ -519,6 +523,7 @@ class Wappalyzer {
const promises = []; const promises = [];
Object.keys(patterns).forEach(cookieName => { Object.keys(patterns).forEach(cookieName => {
if (typeof patterns[cookieName] != 'function') {
cookieName = cookieName.toLowerCase(); cookieName = cookieName.toLowerCase();
promises.push(this.asyncForEach(patterns[cookieName], pattern => { promises.push(this.asyncForEach(patterns[cookieName], pattern => {
@ -528,6 +533,7 @@ class Wappalyzer {
this.addDetected(app, pattern, 'cookies', cookie.value, cookieName); this.addDetected(app, pattern, 'cookies', cookie.value, cookieName);
} }
})); }));
}
}); });
return promises ? Promise.all(promises) : Promise.resolve(); return promises ? Promise.all(promises) : Promise.resolve();
@ -540,6 +546,7 @@ class Wappalyzer {
const promises = []; const promises = [];
Object.keys(results).forEach(string => { Object.keys(results).forEach(string => {
if (typeof results[string] != 'function') {
promises.push(this.asyncForEach(Object.keys(results[string]), index => { promises.push(this.asyncForEach(Object.keys(results[string]), index => {
const pattern = this.jsPatterns[app.name][string][index]; const pattern = this.jsPatterns[app.name][string][index];
const value = results[string][index]; const value = results[string][index];
@ -548,6 +555,7 @@ class Wappalyzer {
this.addDetected(app, pattern, 'js', value); this.addDetected(app, pattern, 'js', value);
} }
})); }));
}
}); });
return promises ? Promise.all(promises) : Promise.resolve(); return promises ? Promise.all(promises) : Promise.resolve();