Fix for implies with confidence value

main
Elbert Alias 4 years ago
parent 94a4ee5306
commit 1a605c4171

@ -153,7 +153,7 @@ a:hover {
.technology__confidence { .technology__confidence {
opacity: .5; opacity: .5;
font-size: .7rem; font-size: .7rem;
margin-left: .2rem; margin-left: .4rem;
} }
.technology__version { .technology__version {

@ -133,7 +133,7 @@ const Popup = {
) )
technologies technologies
.filter(({ confidence }) => confidence) .filter(({ confidence }) => confidence >= 50)
.forEach(({ name, slug, confidence, version, icon, website }) => { .forEach(({ name, slug, confidence, version, icon, website }) => {
const technologyNode = Popup.templates.technology.cloneNode(true) const technologyNode = Popup.templates.technology.cloneNode(true)

@ -108,7 +108,7 @@ const Wappalyzer = {
resolveExcludes(resolved) { resolveExcludes(resolved) {
resolved.forEach(({ technology }) => { resolved.forEach(({ technology }) => {
technology.excludes.forEach((name) => { technology.excludes.forEach(({ name }) => {
const excluded = Wappalyzer.getTechnology(name) const excluded = Wappalyzer.getTechnology(name)
if (!excluded) { if (!excluded) {
@ -131,7 +131,7 @@ const Wappalyzer = {
resolved.forEach(({ technology, confidence }) => { resolved.forEach(({ technology, confidence }) => {
done = true done = true
technology.implies.forEach((name) => { technology.implies.forEach(({ name, confidence: _confidence }) => {
const implied = Wappalyzer.getTechnology(name) const implied = Wappalyzer.getTechnology(name)
if (!implied) { if (!implied) {
@ -143,7 +143,11 @@ const Wappalyzer = {
({ technology: { name } }) => name === implied.name ({ technology: { name } }) => name === implied.name
) === -1 ) === -1
) { ) {
resolved.push({ technology: implied, confidence, version: '' }) resolved.push({
technology: implied,
confidence: Math.min(confidence, _confidence),
version: ''
})
done = false done = false
} }
@ -209,8 +213,13 @@ const Wappalyzer = {
meta: transform(meta), meta: transform(meta),
scripts: transform(script), scripts: transform(script),
js: transform(js), js: transform(js),
implies: typeof implies === 'string' ? [implies] : implies || [], implies: transform(implies).map(({ value, confidence }) => ({
excludes: typeof excludes === 'string' ? [excludes] : excludes || [], name: value,
confidence
})),
excludes: transform(excludes).map(({ value }) => ({
name: value
})),
icon: icon || 'default.svg', icon: icon || 'default.svg',
website: website || '' website: website || ''
}) })
@ -248,7 +257,7 @@ const Wappalyzer = {
const parsed = Object.keys(patterns).reduce((parsed, key) => { const parsed = Object.keys(patterns).reduce((parsed, key) => {
parsed[key.toLowerCase()] = toArray(patterns[key]).map((pattern) => { parsed[key.toLowerCase()] = toArray(patterns[key]).map((pattern) => {
const { regex, confidence, version } = pattern const { value, regex, confidence, version } = pattern
.split('\\;') .split('\\;')
.reduce((attrs, attr, i) => { .reduce((attrs, attr, i) => {
if (i) { if (i) {
@ -259,6 +268,8 @@ const Wappalyzer = {
attrs[attr.shift()] = attr.join(':') attrs[attr.shift()] = attr.join(':')
} }
} else { } else {
attrs.value = attr
// Escape slashes in regular expression // Escape slashes in regular expression
attrs.regex = new RegExp(attr.replace(/\//g, '\\/'), 'i') attrs.regex = new RegExp(attr.replace(/\//g, '\\/'), 'i')
} }
@ -267,6 +278,7 @@ const Wappalyzer = {
}, {}) }, {})
return { return {
value,
regex, regex,
confidence: parseInt(confidence || 100, 10), confidence: parseInt(confidence || 100, 10),
version: version || '' version: version || ''

Loading…
Cancel
Save