From 5c68a1503f62a775453f6351bb7fe82e09382191 Mon Sep 17 00:00:00 2001 From: Elbert Alias Date: Tue, 7 Nov 2017 15:33:08 +1100 Subject: [PATCH] Fix page error halting NPM driver --- src/drivers/npm/README.md | 3 ++- src/drivers/npm/driver.js | 12 +++++------- src/drivers/npm/index.js | 3 ++- src/drivers/webextension/js/driver.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/drivers/npm/README.md b/src/drivers/npm/README.md index f8f7b9eaa..cad8f6a3b 100644 --- a/src/drivers/npm/README.md +++ b/src/drivers/npm/README.md @@ -30,7 +30,8 @@ $ node index.js https://wappalyzer.com ```javascript const options = { userAgent: 'Wappalyzer', - maxWait: 3000 + maxWait: 3000, + debug: false }; const wappalyzer = require('wappalyzer')(options); diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 064648fcd..c845a52a0 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -11,8 +11,6 @@ const driver = options => { const json = JSON.parse(fs.readFileSync(__dirname + '/apps.json')); return { - quiet: true, - analyze: url => { const wappalyzer = new Wappalyzer(); @@ -25,7 +23,7 @@ const driver = options => { return reject(message); } - if ( !driver.quiet ) { + if ( Boolean(options.debug) ) { console.log('[wappalyzer ' + type + ']', '[' + source + ']', message); } }; @@ -63,11 +61,12 @@ const driver = options => { browser.visit(url, error => { if ( !browser.resources['0'].response ) { - return reject('No response from server'); + return wappalyzer.log('No response from server', 'driver', 'error'); } browser.wait(options.maxWait) - .then(() => { + .catch(error => wappalyzer.log(error.message, 'browser')) + .finally(() => { wappalyzer.driver.document = browser.document; const headers = {}; @@ -86,8 +85,7 @@ const driver = options => { html, env: vars }); - }) - .catch(error => reject(error)); + }); }); }); } diff --git a/src/drivers/npm/index.js b/src/drivers/npm/index.js index d18b6b278..31f4dc954 100644 --- a/src/drivers/npm/index.js +++ b/src/drivers/npm/index.js @@ -2,7 +2,8 @@ const options = { userAgent: null, - maxWait: 3000 + maxWait: 3000, + debug: false }; const args = process.argv.slice(2); diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 0c2cd2ff6..a0fac8fff 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -313,7 +313,7 @@ wappalyzer.driver.ping = (hostnameCache, adCache) => { .then(tracking => { if ( tracking ) { if ( Object.keys(hostnameCache).length ) { - post('http://ping.wappalyzer.com/v2/', hostnameCache); + post('http://ping.wappalyzer.com/v3/', hostnameCache); } if ( adCache.length ) {