diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index ca5caa7e8..60c0f978b 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -31,19 +31,18 @@ const Driver = { ...hostnameCache[hostname], detections: hostnameCache[hostname].detections.map( ({ - pattern: { regex, confidence, version }, - match, - technology: name + technology: name, + pattern: { regex, confidence }, + version }) => ({ + technology: Wappalyzer.technologies.find( + ({ name: _name }) => name === _name + ), pattern: { regex: new RegExp(regex, 'i'), - confidence, - version + confidence }, - match, - technology: Wappalyzer.technologies.find( - ({ name: _name }) => name === _name - ) + version }) ) } @@ -69,7 +68,7 @@ const Driver = { if (previous === null) { Driver.open('https://www.wappalyzer.com/installed') } else if (version !== previous && upgradeMessage) { - Driver.open(`https://www.wappalyzer.com/upgraded?v${version}`, false) + // Driver.open(`https://www.wappalyzer.com/upgraded?v${version}`, false) } await setOption('version', version) @@ -262,17 +261,16 @@ const Driver = { ...Driver.cache.hostnames[hostname], detections: Driver.cache.hostnames[hostname].detections.map( ({ - pattern: { regex, confidence, version }, - match, - technology: { name: technology } + technology: { name: technology }, + pattern: { regex, confidence }, + version }) => ({ technology, pattern: { regex: regex.source, - confidence, - version + confidence }, - match + version }) ) } diff --git a/src/wappalyzer.js b/src/wappalyzer.js index e72eb8af7..a33048baa 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -30,17 +30,17 @@ const Wappalyzer = { let version = '' let confidence = 0 - detections.forEach(({ technology: { name }, pattern, match }) => { - if (name === technology.name) { - const versionValue = Wappalyzer.resolveVersion(pattern, match) - - confidence = Math.min(100, confidence + pattern.confidence) - version = - versionValue.length > version.length && versionValue.length <= 10 - ? versionValue - : version + detections.forEach( + ({ technology: { name }, pattern, version: _version = '' }) => { + if (name === technology.name) { + confidence = Math.min(100, confidence + pattern.confidence) + version = + _version.length > version.length && _version.length <= 10 + ? _version + : version + } } - }) + ) resolved.push({ technology, confidence, version }) } @@ -287,7 +287,11 @@ const Wappalyzer = { analyzeOneToOne(technology, type, value) { return technology[type].reduce((technologies, pattern) => { if (pattern.regex.test(value)) { - technologies.push({ technology, pattern, match: value }) + technologies.push({ + technology, + pattern, + version: Wappalyzer.resolveVersion(pattern, value) + }) } return technologies @@ -300,7 +304,11 @@ const Wappalyzer = { patterns.forEach((pattern) => { if (pattern.regex.test(value)) { - technologies.push({ technology, pattern, match: value }) + technologies.push({ + technology, + pattern, + version: Wappalyzer.resolveVersion(pattern, value) + }) } }) @@ -316,7 +324,11 @@ const Wappalyzer = { patterns.forEach((pattern) => { values.forEach((value) => { if (pattern.regex.test(value)) { - technologies.push({ technology, pattern, match: value }) + technologies.push({ + technology, + pattern, + version: Wappalyzer.resolveVersion(pattern, value) + }) } }) })