From b7b70ecdabd3d80c30a7224b8d2b2a2003fce0a0 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Tue, 2 Nov 2021 13:22:59 +1100 Subject: [PATCH] Prevent repeat analysis of the identical XHR requests --- src/drivers/npm/driver.js | 10 +++++++++- src/wappalyzer.js | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index a75f7c8fb..11ef71d52 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -415,6 +415,7 @@ class Site { } this.analyzedUrls = {} + this.analyzedXhr = {} this.analyzedRequires = {} this.detections = [] @@ -549,7 +550,14 @@ class Site { setTimeout(async () => { xhrDebounce.splice(xhrDebounce.indexOf(hostname), 1) - await this.onDetect(url, await analyze({ xhr: hostname })) + this.analyzedXhr[url.hostname] = + this.analyzedXhr[url.hostname] || [] + + if (!this.analyzedXhr[url.hostname].includes(hostname)) { + this.analyzedXhr[url.hostname].push(hostname) + + await this.onDetect(url, await analyze({ xhr: hostname })) + } }, 1000) } } diff --git a/src/wappalyzer.js b/src/wappalyzer.js index fbc77625d..1f5d1f403 100644 --- a/src/wappalyzer.js +++ b/src/wappalyzer.js @@ -223,6 +223,10 @@ const Wappalyzer = { }, technologies = Wappalyzer.technologies ) { + if (xhr) { + console.log('analyze', xhr) + } + const oo = Wappalyzer.analyzeOneToOne const om = Wappalyzer.analyzeOneToMany const mm = Wappalyzer.analyzeManyToMany