diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 8e41b6d65..5cbf30242 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -114,12 +114,12 @@ class Driver { headers[header[0]].push(header[1]); }); + let html = ''; + try { - const html = browser.html(); + html = browser.html(); } catch ( e ) { this.wappalyzer.log(error.message, 'browser', 'error'); - - const html = ''; } const vars = Object.getOwnPropertyNames(browser.window); diff --git a/src/wappalyzer.js b/src/wappalyzer.js index 9936e6b9e..a3f714e56 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -68,7 +68,7 @@ class Wappalyzer { if ( data.scripts ) { this.analyzeScripts(app, data.scripts); } - + if ( data.headers ) { this.analyzeHeaders(app, data.headers); } @@ -181,13 +181,17 @@ class Wappalyzer { * Enclose string in array */ asArray(value) { - return typeof value === 'string' ? [ value ] : value; + return value instanceof Array ? value : [ value ]; } /** * Parse apps.json patterns */ parsePatterns(patterns) { + if ( !patterns ) { + return []; + } + var parsed = {}; // Convert string to object containing array containing string @@ -197,7 +201,7 @@ class Wappalyzer { }; } - for ( var key in patterns ) { + Object.keys(patterns).forEach(key => { parsed[key] = []; this.asArray(patterns[key]).forEach(pattern => { @@ -226,7 +230,7 @@ class Wappalyzer { parsed[key].push(attrs); }); - } + }); // Convert back to array if the original pattern list was an array (or string) if ( 'main' in parsed ) {