@fanboynz/network-scanner 1.0.73 → 1.0.74

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 (2) hide show
  1. package/nwss.js +29 -3
  2. package/package.json +1 -1
package/nwss.js CHANGED
@@ -1,4 +1,4 @@
1
- // === Network scanner script (nwss.js) v1.0.73 ===
1
+ // === Network scanner script (nwss.js) v1.0.74 ===
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
@@ -123,7 +123,7 @@ const { navigateWithRedirectHandling, handleRedirectTimeout } = require('./lib/r
123
123
  const { monitorBrowserHealth, isBrowserHealthy } = require('./lib/browserhealth');
124
124
 
125
125
  // --- Script Configuration & Constants ---
126
- const VERSION = '1.0.73'; // Script version
126
+ const VERSION = '1.0.74'; // Script version
127
127
 
128
128
  // get startTime
129
129
  const startTime = Date.now();
@@ -2111,7 +2111,15 @@ function setupFrameHandling(page, forceDebug) {
2111
2111
 
2112
2112
  // REMOVED: Check if this URL matches any blocked patterns - if so, skip detection but still continue browser blocking
2113
2113
  // This check is no longer needed here since even_blocked handles it above
2114
-
2114
+
2115
+ // Check if nettools validation is required - if so, NEVER add domains immediately
2116
+ if (hasNetTools) {
2117
+ if (forceDebug) {
2118
+ console.log(formatLogMessage('debug', `${reqUrl} has nettools validation required - skipping immediate add`));
2119
+ }
2120
+ request.continue();
2121
+ return;
2122
+ }
2115
2123
 
2116
2124
  // If NO searchstring AND NO nettools are defined, match immediately (existing behavior)
2117
2125
  if (!hasSearchString && !hasSearchStringAnd && !hasNetTools) {
@@ -2152,6 +2160,12 @@ function setupFrameHandling(page, forceDebug) {
2152
2160
  console.log(formatLogMessage('debug', `${reqUrl} matched regex ${matchedRegexPattern} and resourceType ${resourceType}, queued for nettools check`));
2153
2161
  }
2154
2162
 
2163
+ // IMPORTANT: Do NOT add domain immediately when nettools validation is required
2164
+ // The nettools handler will add the domain only if validation passes
2165
+ if (forceDebug) {
2166
+ console.log(formatLogMessage('debug', `Domain ${reqDomain} queued for mandatory nettools validation (dig: ${JSON.stringify(siteConfig.dig)})`));
2167
+ }
2168
+
2155
2169
  if (dryRunMode) {
2156
2170
  // For dry run, we'll collect the domain for nettools checking
2157
2171
  matchedDomains.get('dryRunMatches').push({
@@ -2212,6 +2226,12 @@ function setupFrameHandling(page, forceDebug) {
2212
2226
  // Execute nettools check asynchronously
2213
2227
  const originalDomain = fullSubdomain; // Use full subdomain for nettools
2214
2228
  setImmediate(() => netToolsHandler(reqDomain, originalDomain));
2229
+
2230
+ // Do NOT continue processing this request for immediate domain addition
2231
+ // The nettools handler is responsible for adding the domain if validation passes
2232
+ if (forceDebug) {
2233
+ console.log(formatLogMessage('debug', `Request processing halted for ${reqUrl} - awaiting nettools validation`));
2234
+ }
2215
2235
  } else {
2216
2236
  // If searchstring or searchstring_and IS defined (with or without nettools), queue for content checking
2217
2237
  // Skip searchstring check if full subdomain was already detected
@@ -2237,6 +2257,12 @@ function setupFrameHandling(page, forceDebug) {
2237
2257
  needsSearchStringCheck: true
2238
2258
  });
2239
2259
  }
2260
+ // If we have BOTH searchstring AND nettools, ensure nettools validation still happens
2261
+ if (hasNetTools) {
2262
+ if (forceDebug) {
2263
+ console.log(formatLogMessage('debug', `${reqUrl} requires both content and nettools validation`));
2264
+ }
2265
+ }
2240
2266
  }
2241
2267
 
2242
2268
  // If curl is enabled, download and analyze content immediately
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanboynz/network-scanner",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
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": {