From 957549305722a5b2084d49b2edd1c4b52728ee88 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Tue, 16 Jun 2020 11:19:33 +1000 Subject: [PATCH] Build v6.0.12 --- src/drivers/npm/driver.js | 99 +++++++++----------------- src/drivers/npm/package.json | 2 +- src/drivers/webextension/manifest.json | 2 +- src/package.json | 2 +- 4 files changed, 35 insertions(+), 70 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 9aa65deba..7b7fc079e 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -57,43 +57,6 @@ function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)) } -function getJs() { - const dereference = (obj, level = 0) => { - try { - // eslint-disable-next-line no-undef - if (level > 5 || (level && obj === window)) { - return '[Removed]' - } - - if (Array.isArray(obj)) { - obj = obj.map((item) => dereference(item, level + 1)) - } - - if ( - typeof obj === 'function' || - (typeof obj === 'object' && obj !== null) - ) { - const newObj = {} - - Object.keys(obj) - .filter((key) => obj.hasOwnProperty(key)) - .forEach((key) => { - newObj[key] = dereference(obj[key], level + 1) - }) - - return newObj - } - - return obj - } catch (error) { - return undefined - } - } - - // eslint-disable-next-line no-undef - return dereference(window) -} - function analyzeJs(js) { return Array.prototype.concat.apply( [], @@ -375,37 +338,39 @@ class Site { ).jsonValue() // JavaScript - const win = await page.evaluate(getJs) - - const js = Wappalyzer.technologies - .filter(({ js }) => Object.keys(js).length) - .map(({ name, js }) => ({ name, chains: Object.keys(js) })) - .reduce((technologies, { name, chains }) => { - chains.forEach((chain) => { - const value = chain - .split('.') - .reduce( - (value, method) => - value && value.hasOwnProperty(method) - ? value[method] - : undefined, - win - ) - - if (typeof value !== 'undefined') { - technologies.push({ - name, - chain, - value: - typeof value === 'string' || typeof value === 'number' - ? value - : !!value - }) - } - }) + const js = await page.evaluate( + (technologies) => { + return technologies.reduce((technologies, { name, chains }) => { + chains.forEach((chain) => { + const value = chain + .split('.') + .reduce( + (value, method) => + value && value.hasOwnProperty(method) + ? value[method] + : undefined, + window + ) + + if (typeof value !== 'undefined') { + technologies.push({ + name, + chain, + value: + typeof value === 'string' || typeof value === 'number' + ? value + : !!value + }) + } + }) - return technologies - }, []) + return technologies + }, []) + }, + Wappalyzer.technologies + .filter(({ js }) => Object.keys(js).length) + .map(({ name, js }) => ({ name, chains: Object.keys(js) })) + ) // Cookies const cookies = (await page.cookies()).reduce( diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index 31ca22f3e..cd9540b0c 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com", - "version": "6.0.11", + "version": "6.0.12", "author": "Wappalyzer", "license": "MIT", "repository": { diff --git a/src/drivers/webextension/manifest.json b/src/drivers/webextension/manifest.json index f90775ed6..67d481573 100644 --- a/src/drivers/webextension/manifest.json +++ b/src/drivers/webextension/manifest.json @@ -4,7 +4,7 @@ "author": "Wappalyzer", "homepage_url": "https://www.wappalyzer.com", "description": "Identify web technologies", - "version": "6.0.11", + "version": "6.0.12", "default_locale": "en", "manifest_version": 2, "icons": { diff --git a/src/package.json b/src/package.json index aed9c5ed9..0d0279b5d 100644 --- a/src/package.json +++ b/src/package.json @@ -13,7 +13,7 @@ "software" ], "homepage": "https://www.wappalyzer.com", - "version": "6.0.11", + "version": "6.0.12", "author": "Wappalyzer", "license": "MIT", "repository": {