From e75574697892ddbb2f3b933d6958ce108f0ea2c2 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Wed, 1 Dec 2021 15:06:13 +1100 Subject: [PATCH] Update Node.js dependency --- README.md | 2 +- src/categories.json | 6 ++-- src/drivers/npm/driver.js | 13 +++----- src/drivers/npm/package.json | 5 ++- src/drivers/webextension/js/driver.js | 10 +++--- src/wappalyzer.js | 46 +++++++++++---------------- 6 files changed, 36 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 1b1356a4c..644cd52d3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you don't have time to configure, host, debug and maintain your own infrastru ## Prerequisites - [Git](https://git-scm.com) -- [Node.js](https://nodejs.org) version 12 or higher +- [Node.js](https://nodejs.org) version 14 or higher - [Yarn](https://yarnpkg.com) ## Quick start diff --git a/src/categories.json b/src/categories.json index 389623e20..f59ad9a8f 100644 --- a/src/categories.json +++ b/src/categories.json @@ -64,7 +64,7 @@ 7 ], "name": "Hosting panels", - "priority": 1 + "priority": 2 }, "10": { "groups": [ @@ -136,7 +136,7 @@ 6 ], "name": "Miscellaneous", - "priority": 9 + "priority": 10 }, "20": { "groups": [ @@ -685,4 +685,4 @@ "name": "Shipping carriers", "priority": 9 } -} \ No newline at end of file +} diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index a0dfaf602..367321316 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -552,7 +552,7 @@ class Site { if (!this.analyzedXhr[url.hostname].includes(hostname)) { this.analyzedXhr[url.hostname].push(hostname) - await this.onDetect(url, await analyze({ xhr: hostname })) + await this.onDetect(url, analyze({ xhr: hostname })) } }, 1000) } @@ -590,7 +590,7 @@ class Site { ) { const scripts = await response.text() - await this.onDetect(response.url(), await analyze({ scripts })) + await this.onDetect(response.url(), analyze({ scripts })) } if (response.url() === url.href) { @@ -634,7 +634,7 @@ class Site { ? response.securityDetails().issuer() : '' - await this.onDetect(url, await analyze({ headers, certIssuer })) + await this.onDetect(url, analyze({ headers, certIssuer })) await this.emit('response', { page, response, headers, certIssuer }) } @@ -1076,10 +1076,7 @@ class Site { this.log(`Probe ok (${path})`) - await this.onDetect( - url, - await analyze({ [file]: body.slice(0, 100000) }) - ) + await this.onDetect(url, analyze({ [file]: body.slice(0, 100000) })) } catch (error) { this.error(`Probe failed (${path}): ${error.message || error}`) } @@ -1117,7 +1114,7 @@ class Site { `Probe DNS ok: (${Object.values(dnsRecords).flat().length} records)` ) - await this.onDetect(url, await analyze({ dns: dnsRecords })) + await this.onDetect(url, analyze({ dns: dnsRecords })) resolve() }), diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index 70b0bc833..2f4560c7f 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -42,5 +42,8 @@ }, "dependencies": { "puppeteer": "^10.4.0" + }, + "engines": { + "node": ">=14" } -} \ No newline at end of file +} diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 7a69fee73..875e24dc8 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -416,9 +416,7 @@ const Driver = { ) }) - Driver.onDetect(request.url, await analyze({ headers })).catch( - Driver.error - ) + Driver.onDetect(request.url, analyze({ headers })).catch(Driver.error) } } catch (error) { Driver.error(error) @@ -444,7 +442,7 @@ const Driver = { const scripts = await response.text() - Driver.onDetect(request.documentUrl, await analyze({ scripts })).catch( + Driver.onDetect(request.documentUrl, analyze({ scripts })).catch( Driver.error ) } @@ -492,7 +490,7 @@ const Driver = { Driver.onDetect( request.originUrl || request.initiator, - await analyze({ xhr: hostname }) + analyze({ xhr: hostname }) ).catch(Driver.error) } }, 1000) @@ -522,7 +520,7 @@ const Driver = { await Driver.onDetect( url, - await analyze({ url, ...items }, technologies), + analyze({ url, ...items }, technologies), language, true ) diff --git a/src/wappalyzer.js b/src/wappalyzer.js index b0573bd40..2fa93c405 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -1,9 +1,5 @@ 'use strict' -function next() { - return new Promise((resolve) => setTimeout(resolve, 0)) -} - function toArray(value) { return Array.isArray(value) ? value : [value] } @@ -204,7 +200,7 @@ const Wappalyzer = { * Initialize analyzation. * @param {*} param0 */ - async analyze( + analyze( { url, xhr, @@ -231,28 +227,24 @@ const Wappalyzer = { try { const detections = flatten( - await Promise.all( - technologies.map(async (technology) => { - await next() - - return flatten([ - oo(technology, 'url', url), - oo(technology, 'xhr', xhr), - oo(technology, 'html', html), - oo(technology, 'text', text), - oo(technology, 'scripts', scripts), - oo(technology, 'css', css), - oo(technology, 'robots', robots), - oo(technology, 'magento', magento), - oo(technology, 'certIssuer', certIssuer), - om(technology, 'scriptSrc', scriptSrc), - mm(technology, 'cookies', cookies), - mm(technology, 'meta', meta), - mm(technology, 'headers', headers), - mm(technology, 'dns', dns), - ]) - }) - ) + technologies.map((technology) => { + return flatten([ + oo(technology, 'url', url), + oo(technology, 'xhr', xhr), + oo(technology, 'html', html), + oo(technology, 'text', text), + oo(technology, 'scripts', scripts), + oo(technology, 'css', css), + oo(technology, 'robots', robots), + oo(technology, 'magento', magento), + oo(technology, 'certIssuer', certIssuer), + om(technology, 'scriptSrc', scriptSrc), + mm(technology, 'cookies', cookies), + mm(technology, 'meta', meta), + mm(technology, 'headers', headers), + mm(technology, 'dns', dns), + ]) + }) ).filter((technology) => technology) return detections