@fanboynz/network-scanner 2.0.18 → 2.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/output.js +22 -3
  2. package/nwss.js +2 -2
  3. package/package.json +1 -1
package/lib/output.js CHANGED
@@ -338,8 +338,8 @@ function removeDuplicates(lines) {
338
338
  function buildOutputLines(results, options = {}) {
339
339
  const { showTitles = false, removeDupes = false, ignoreDomains = [], forLogFile = false } = options;
340
340
 
341
- // Filter and collect successful results with rules
342
- const finalSiteRules = [];
341
+ // Consolidate rules from all results, handling multiple results for same URL
342
+ const consolidatedRules = new Map(); // URL -> Set of rules
343
343
  let successfulPageLoads = 0;
344
344
 
345
345
  results.forEach(result => {
@@ -348,10 +348,29 @@ function buildOutputLines(results, options = {}) {
348
348
  successfulPageLoads++;
349
349
  }
350
350
  if (result.rules && result.rules.length > 0) {
351
- finalSiteRules.push({ url: result.url, rules: result.rules });
351
+ // Consolidate rules by URL to handle multiple site entries for same URL
352
+ if (!consolidatedRules.has(result.url)) {
353
+ consolidatedRules.set(result.url, new Set());
354
+ }
355
+
356
+ // Add all rules from this result to the consolidated set
357
+ result.rules.forEach(rule => {
358
+ consolidatedRules.get(result.url).add(rule);
359
+ });
352
360
  }
353
361
  }
354
362
  });
363
+
364
+ // Convert consolidated rules back to array format
365
+ const finalSiteRules = [];
366
+ consolidatedRules.forEach((rulesSet, url) => {
367
+ if (rulesSet.size > 0) {
368
+ finalSiteRules.push({
369
+ url: url,
370
+ rules: Array.from(rulesSet)
371
+ });
372
+ }
373
+ });
355
374
 
356
375
  // Build output lines
357
376
  const outputLines = [];
package/nwss.js CHANGED
@@ -1,4 +1,4 @@
1
- // === Network scanner script (nwss.js) v2.0.18 ===
1
+ // === Network scanner script (nwss.js) v2.0.19 ===
2
2
 
3
3
  // puppeteer for browser automation, fs for file system operations, psl for domain parsing.
4
4
  // const pLimit = require('p-limit'); // Will be dynamically imported
@@ -130,7 +130,7 @@ const { navigateWithRedirectHandling, handleRedirectTimeout } = require('./lib/r
130
130
  const { monitorBrowserHealth, isBrowserHealthy, isQuicklyResponsive, performGroupWindowCleanup, performRealtimeWindowCleanup, trackPageForRealtime, updatePageUsage, cleanupPageBeforeReload } = require('./lib/browserhealth');
131
131
 
132
132
  // --- Script Configuration & Constants ---
133
- const VERSION = '2.0.18'; // Script version
133
+ const VERSION = '2.0.19'; // Script version
134
134
 
135
135
  // get startTime
136
136
  const startTime = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanboynz/network-scanner",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "A Puppeteer-based network scanner for analyzing web traffic, generating adblock filter rules, and identifying third-party requests. Features include fingerprint spoofing, Cloudflare bypass, content analysis with curl/grep, and multiple output formats.",
5
5
  "main": "nwss.js",
6
6
  "scripts": {