diff --git a/src/drivers/npm/README.md b/src/drivers/npm/README.md index b6f3ae7cc..29078d2f3 100644 --- a/src/drivers/npm/README.md +++ b/src/drivers/npm/README.md @@ -27,9 +27,9 @@ node index.js [url] [options] ### Options ``` - --password Password to be used for basic HTTP authentication - --proxy Proxy URL, e.g. 'http://user:pass@proxy:8080' - --username Username to be used for basic HTTP authentication + --password Password to be used for basic HTTP authentication + --proxy Proxy URL, e.g. 'http://user:pass@proxy:8080' + --username Username to be used for basic HTTP authentication --chunk-size=num Process links in chunks. --debug=0|1 Output debug messages. --delay=ms Wait for ms milliseconds between requests. diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index f89284174..0067fa0d5 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -2,7 +2,7 @@ "name": "wappalyzer", "description": "Uncovers the technologies used on websites", "homepage": "https://github.com/AliasIO/Wappalyzer", - "version": "5.6.0", + "version": "5.6.1", "author": "Elbert Alias", "license": "GPL-3.0", "repository": { @@ -12,6 +12,7 @@ "main": "driver.js", "files": [ "apps.json", + "browsers/zombie.js", "index.js", "driver.js", "wappalyzer.js" diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 0d3efcd40..1336809d4 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -24,20 +24,22 @@ browser.tabs.onRemoved.addListener((tabId) => { * Get a value from localStorage */ function getOption(name, defaultValue = null) { - return new Promise(async (resolve) => { + return new Promise(async (resolve, reject) => { let value = defaultValue; try { const option = await browser.storage.local.get(name); - if (option[name]) { + if (option[name] !== undefined) { value = option[name]; } } catch (error) { - wappalyzer.log(error, 'driver', 'error'); + wappalyzer.log(error.message, 'driver', 'error'); + + return reject(error.message); } - resolve(value); + return resolve(value); }); } @@ -45,14 +47,16 @@ function getOption(name, defaultValue = null) { * Set a value in localStorage */ function setOption(name, value) { - return new Promise(async (resolve) => { + return new Promise(async (resolve, reject) => { try { await browser.storage.local.set({ [name]: value }); } catch (error) { - wappalyzer.log(error, 'driver', 'error'); + wappalyzer.log(error.message, 'driver', 'error'); + + return reject(error.message); } - resolve(); + return resolve(); }); } @@ -334,10 +338,10 @@ wappalyzer.driver.ping = async (hostnameCache = {}, adCache = []) => { url: `${wappalyzer.config.websiteURL}installed`, }); } else if (version !== previousVersion && upgradeMessage) { - //openTab({ - // url: `${wappalyzer.config.websiteURL}upgraded?v${version}`, - // background: true, - //}); + openTab({ + url: `${wappalyzer.config.websiteURL}upgraded?v${version}`, + background: true, + }); } await setOption('version', version); diff --git a/src/drivers/webextension/js/options.js b/src/drivers/webextension/js/options.js index 2282498df..4666b0045 100644 --- a/src/drivers/webextension/js/options.js +++ b/src/drivers/webextension/js/options.js @@ -1,26 +1,51 @@ /** global: browser */ /** global: Wappalyzer */ -/* globals browser chrome Wappalyzer */ +/* globals browser Wappalyzer */ /* eslint-env browser */ const wappalyzer = new Wappalyzer(); -function getOption(name, defaultValue, callback) { - browser.storage.local.get(name) - .then((item) => { - callback(item.hasOwnProperty(name) ? item[name] : defaultValue); - }); +/** + * Get a value from localStorage + */ +function getOption(name, defaultValue = null) { + return new Promise(async (resolve, reject) => { + let value = defaultValue; + + try { + const option = await browser.storage.local.get(name); + + if (option[name] !== undefined) { + value = option[name]; + } + } catch (error) { + wappalyzer.log(error.message, 'driver', 'error'); + + return reject(error.message); + } + + return resolve(value); + }); } +/** + * Set a value in localStorage + */ function setOption(name, value) { - (chrome || browser).runtime.sendMessage({ - id: 'set_option', - key: name, - value, + return new Promise(async (resolve, reject) => { + try { + await browser.storage.local.set({ [name]: value }); + } catch (error) { + wappalyzer.log(error.message, 'driver', 'error'); + + return reject(error.message); + } + + return resolve(); }); } -document.addEventListener('DOMContentLoaded', () => { +document.addEventListener('DOMContentLoaded', async () => { const nodes = document.querySelectorAll('[data-i18n]'); Array.prototype.forEach.call(nodes, (node) => { @@ -39,33 +64,33 @@ document.addEventListener('DOMContentLoaded', () => { window.open(wappalyzer.config.websiteURL); }); - getOption('upgradeMessage', true, (value) => { - const el = document.querySelector('#option-upgrade-message'); + let el; + let value; - el.checked = value; + // Upgrade message + value = await getOption('upgradeMessage', true); - el.addEventListener('change', () => { - setOption('upgradeMessage', el.checked); - }); - }); + el = document.querySelector('#option-upgrade-message'); - getOption('dynamicIcon', true, (value) => { - const el = document.querySelector('#option-dynamic-icon'); + el.checked = value; - el.checked = value; + el.addEventListener('change', e => setOption('upgradeMessage', e.target.checked)); - el.addEventListener('change', () => { - setOption('dynamicIcon', el.checked); - }); - }); + // Dynamic icon + value = await getOption('dynamicIcon', true); - getOption('tracking', true, (value) => { - const el = document.querySelector('#option-tracking'); + el = document.querySelector('#option-dynamic-icon'); - el.checked = value; + el.checked = value; - el.addEventListener('change', () => { - setOption('tracking', el.checked); - }); - }); + el.addEventListener('change', e => setOption('dynamicIcon', e.target.checked)); + + // Tracking + value = await getOption('tracking', true); + + el = document.querySelector('#option-tracking'); + + el.checked = value; + + el.addEventListener('change', e => setOption('tracking', e.target.checked)); }); diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index ef7dc4df8..bb1146b10 100644 --- a/src/drivers/webextension/manifest.json +++ b/src/drivers/webextension/manifest.json @@ -4,7 +4,7 @@ "author": "Elbert Alias", "homepage_url": "https://www.wappalyzer.com", "description": "Identify web technologies", - "version": "5.6.0", + "version": "5.6.1", "default_locale": "en", "manifest_version": 2, "icons": {