Return match in extended output

main
Elbert Alias 3 years ago
parent 5f629ad25a
commit 50cb0ba288

@ -998,7 +998,7 @@ class Site {
patterns, patterns,
{ {
technology: { name, implies, excludes }, technology: { name, implies, excludes },
pattern: { regex, value, confidence, type, version }, pattern: { regex, value, match, confidence, type, version },
} }
) => { ) => {
patterns[name] = patterns[name] || [] patterns[name] = patterns[name] || []
@ -1007,6 +1007,7 @@ class Site {
type, type,
regex: regex.source, regex: regex.source,
value: value.length <= 250 ? value : null, value: value.length <= 250 ? value : null,
match: match.length <= 250 ? match : null,
confidence, confidence,
version, version,
implies: implies.map(({ name }) => name), implies: implies.map(({ name }) => name),

@ -554,10 +554,17 @@ const Wappalyzer = {
return technology[type].reduce((technologies, pattern) => { return technology[type].reduce((technologies, pattern) => {
const startTime = Date.now() const startTime = Date.now()
if (pattern.regex.test(value)) { const matches = pattern.regex.exec(value)
if (matches) {
technologies.push({ technologies.push({
technology, technology,
pattern: { ...pattern, type, value }, pattern: {
...pattern,
type,
value,
match: matches[0],
},
version: Wappalyzer.resolveVersion(pattern, value), version: Wappalyzer.resolveVersion(pattern, value),
}) })
} }
@ -581,10 +588,17 @@ const Wappalyzer = {
patterns.forEach((pattern) => { patterns.forEach((pattern) => {
const startTime = Date.now() const startTime = Date.now()
if (pattern.regex.test(value)) { const matches = pattern.regex.exec(value)
if (matches) {
technologies.push({ technologies.push({
technology, technology,
pattern: { ...pattern, type, value }, pattern: {
...pattern,
type,
value,
match: matches[0],
},
version: Wappalyzer.resolveVersion(pattern, value), version: Wappalyzer.resolveVersion(pattern, value),
}) })
} }
@ -618,10 +632,17 @@ const Wappalyzer = {
values.forEach((value) => { values.forEach((value) => {
const startTime = Date.now() const startTime = Date.now()
if (pattern.regex.test(value)) { const matches = pattern.regex.exec(value)
if (matches) {
technologies.push({ technologies.push({
technology, technology,
pattern: { ...pattern, type, value }, pattern: {
...pattern,
type,
value,
match: matches[0],
},
version: Wappalyzer.resolveVersion(pattern, value), version: Wappalyzer.resolveVersion(pattern, value),
}) })
} }

Loading…
Cancel
Save