Fix excludes

main
Elbert Alias 7 years ago
parent 3ce87fe503
commit cfc43567d0

@ -102,14 +102,14 @@ class Wappalyzer {
Promise.all(promises)
.then(() => {
Object.keys(apps).forEach(appName => {
var app = apps[appName];
let app = apps[appName];
if (!app.detected || !app.getConfidence()) {
delete apps[app.name];
}
});
this.resolveExcludes(apps);
this.resolveExcludes(apps, this.detected[url]);
this.resolveImplies(apps, url.canonical);
this.cacheDetectedApps(apps, url.canonical);
@ -287,26 +287,26 @@ class Wappalyzer {
});
}
resolveExcludes(apps) {
var excludes = [];
resolveExcludes(apps, detected) {
let excludes = [];
// Exclude app in detected apps only
Object.keys(apps).forEach(appName => {
var app = apps[appName];
Object.keys(Object.assign({}, apps, detected)).forEach(appName => {
let app = apps[appName];
if (app.props.excludes) {
this.asArray(app.props.excludes).forEach(excluded => {
excludes.push(excluded);
});
}
})
});
// Remove excluded applications
Object.keys(apps).forEach(appName => {
if (excludes.indexOf(appName) > -1) {
delete apps[appName];
}
})
});
}
resolveImplies(apps, url) {
@ -351,14 +351,12 @@ class Wappalyzer {
*/
cacheDetectedApps(apps, url) {
Object.keys(apps).forEach(appName => {
var app = apps[appName];
let app = apps[appName];
// Per URL
this.detected[url][appName] = app;
Object.keys(app.confidence).forEach(id => {
this.detected[url][appName].confidence[id] = app.confidence[id];
});
Object.keys(app.confidence).forEach(id => this.detected[url][appName].confidence[id] = app.confidence[id]);
})
if (this.driver.ping instanceof Function) {