From 2066f0c2166b41a35411a7b902c17cc3107c6fc9 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Fri, 4 Sep 2020 09:43:09 +1000 Subject: [PATCH] Add CSS inspection to NPM driver --- src/drivers/npm/driver.js | 31 +++++++++++++++++++++++++++++++ src/drivers/npm/package.json | 11 ++++++++--- src/package.json | 13 +++++++++---- src/technologies.json | 16 +++++----------- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index 5a6244c45..62b984276 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -363,6 +363,36 @@ class Site { ).jsonValue(), ]) + // CSS + const css = await Promise.race([ + this.timeout(), + ( + await page.evaluateHandle((maxRows) => { + const css = [] + + try { + if (!document.styleSheets.length) { + return '' + } + + for (const sheet of Array.from(document.styleSheets)) { + for (const rules of Array.from(sheet.cssRules)) { + css.push(rules.cssText) + + if (css.length >= maxRows) { + break + } + } + } + } catch (error) { + return '' + } + + return css.join('\n') + }, this.options.htmlMaxRows) + ).jsonValue(), + ]) + // Script tags const scripts = await Promise.race([ this.timeout(), @@ -483,6 +513,7 @@ class Site { url, cookies, html, + css, scripts, meta, }) diff --git a/src/drivers/npm/package.json b/src/drivers/npm/package.json index e7a9b91c0..9864625e9 100644 --- a/src/drivers/npm/package.json +++ b/src/drivers/npm/package.json @@ -20,9 +20,14 @@ "type": "git", "url": "https://github.com/aliasio/wappalyzer" }, - "funding": { - "url": "https://github.com/sponsors/aliasio" - }, + "funding": [ + { + "url": "https://github.com/sponsors/aliasio" + }, + { + "url": "https://paypal.me/aliasio" + } + ], "main": "driver.js", "files": [ "cli.js", diff --git a/src/package.json b/src/package.json index c664c09a6..3c9cbb6f8 100644 --- a/src/package.json +++ b/src/package.json @@ -20,11 +20,16 @@ "type": "git", "url": "https://github.com/aliasio/wappalyzer" }, - "funding": { - "url": "https://github.com/sponsors/aliasio" - }, + "funding": [ + { + "url": "https://github.com/sponsors/aliasio" + }, + { + "url": "https://paypal.me/aliasio" + } + ], "main": "wappalyzer.js", "files": [ "wappalyzer.js" ] -} \ No newline at end of file +} diff --git a/src/technologies.json b/src/technologies.json index 86c1191a8..ab3003db0 100644 --- a/src/technologies.json +++ b/src/technologies.json @@ -5014,6 +5014,10 @@ 41 ], "html": "<[^>]+aria-labelledby=\"pi-google_pay", + "scripts": [ + "checkout\\.google\\.com", + "wallet\\.google\\.com" + ], "icon": "Google.svg", "website": "https://pay.google.com" }, @@ -5065,17 +5069,6 @@ }, "website": "http://www.google.com/tagmanager" }, - "Google Wallet": { - "cats": [ - 41 - ], - "icon": "Google Wallet.png", - "scripts": [ - "checkout\\.google\\.com", - "wallet\\.google\\.com" - ], - "website": "http://wallet.google.com" - }, "Google Web Server": { "cats": [ 22 @@ -10859,6 +10852,7 @@ }, "scripts": "sdks\\.shopifycdn\\.com", "url": "^https?//.+\\.myshopify\\.com", + "description": "Shopify is a commerce platform that allows anyone to set up a store and sell their products online or in person.", "website": "http://shopify.com" }, "Shopline": {