From f27604e81aab8c34de76d4ee91c3047dde49c306 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Wed, 26 Oct 2022 09:36:59 +1100 Subject: [PATCH] Add support for version flag on implies --- bin/validate.js | 4 ++++ src/wappalyzer.js | 43 +++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/bin/validate.js b/bin/validate.js index f80fdbebd..eed49bbbf 100755 --- a/bin/validate.js +++ b/bin/validate.js @@ -157,6 +157,10 @@ Object.keys(technologies).forEach((name) => { flags.forEach((flag) => { const [key, value] = flag.split(':') + if (key === 'version') { + return + } + if (key === 'confidence') { if ( !/^\d+$/.test(value) || diff --git a/src/wappalyzer.js b/src/wappalyzer.js index 73faa81a6..913615504 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -244,28 +244,30 @@ const Wappalyzer = { done = true resolved.forEach(({ technology, confidence, lastUrl }) => { - technology.implies.forEach(({ name, confidence: _confidence }) => { - const implied = Wappalyzer.getTechnology(name) + technology.implies.forEach( + ({ name, confidence: _confidence, version }) => { + const implied = Wappalyzer.getTechnology(name) - if (!implied) { - throw new Error(`Implied technology does not exist: ${name}`) - } - - if ( - resolved.findIndex( - ({ technology: { name } }) => name === implied.name - ) === -1 - ) { - resolved.push({ - technology: implied, - confidence: Math.min(confidence, _confidence), - version: '', - lastUrl, - }) + if (!implied) { + throw new Error(`Implied technology does not exist: ${name}`) + } - done = false + if ( + resolved.findIndex( + ({ technology: { name } }) => name === implied.name + ) === -1 + ) { + resolved.push({ + technology: implied, + confidence: Math.min(confidence, _confidence), + version: version || '', + lastUrl, + }) + + done = false + } } - }) + ) }) } while (resolved.length && !done) }, @@ -389,9 +391,10 @@ const Wappalyzer = { meta: transform(meta), scriptSrc: transform(scriptSrc), js: transform(js, true), - implies: transform(implies).map(({ value, confidence }) => ({ + implies: transform(implies).map(({ value, confidence, version }) => ({ name: value, confidence, + version, })), excludes: transform(excludes).map(({ value }) => ({ name: value,