From e5709c1d589a92868844cd42fc3c80d152034c01 Mon Sep 17 00:00:00 2001 From: Joao Poupino Date: Wed, 7 Dec 2016 13:29:29 +0000 Subject: [PATCH] Ensure regexes are applied to multi-value headers. --- src/wappalyzer.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wappalyzer.js b/src/wappalyzer.js index b6bc25523..565db1af4 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -351,8 +351,16 @@ var wappalyzer = (function() { for ( header in w.apps[app].headers ) { parse(w.apps[app][type][header]).forEach(function(pattern) { - if ( typeof data[type][header.toLowerCase()] === 'string' && pattern.regex.test(data[type][header.toLowerCase()]) ) { - apps[app].setDetected(pattern, type, data[type][header.toLowerCase()], header); + if ( data[type][header.toLowerCase()] instanceof Array ) { + data[type][header.toLowerCase()].forEach(function(el) { + if ( typeof el === 'string' && pattern.regex.test(el) ) { + apps[app].setDetected(pattern, type, data[type][header.toLowerCase()], header); + } + }); + } else { + if ( typeof data[type][header.toLowerCase()] === 'string' && pattern.regex.test(data[type][header.toLowerCase()]) ) { + apps[app].setDetected(pattern, type, data[type][header.toLowerCase()], header); + } } profiler.checkPoint(app, type, pattern.regex);