@fanboynz/network-scanner 2.0.17 → 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.
- package/lib/nettools.js +15 -6
- package/lib/output.js +22 -3
- package/nwss.js +4 -4
- package/package.json +1 -1
package/lib/nettools.js
CHANGED
|
@@ -418,15 +418,17 @@ async function whoisLookupWithRetry(domain, timeout = 10000, whoisServer = null,
|
|
|
418
418
|
|
|
419
419
|
// Add delay between retry attempts to prevent rate limiting
|
|
420
420
|
if (attemptCount > 1) {
|
|
421
|
-
if (
|
|
422
|
-
if (
|
|
423
|
-
logFunc
|
|
424
|
-
|
|
425
|
-
|
|
421
|
+
if (whoisDelay > 0) {
|
|
422
|
+
if (debugMode) {
|
|
423
|
+
if (logFunc) {
|
|
424
|
+
logFunc(`${messageColors.highlight('[whois-retry]')} Adding ${whoisDelay}ms delay before retry attempt...`);
|
|
425
|
+
} else {
|
|
426
|
+
console.log(formatLogMessage('debug', `${messageColors.highlight('[whois-retry]')} Adding ${whoisDelay}ms delay before retry attempt...`));
|
|
427
|
+
}
|
|
426
428
|
}
|
|
429
|
+
await new Promise(resolve => setTimeout(resolve, whoisDelay));
|
|
427
430
|
}
|
|
428
431
|
|
|
429
|
-
await new Promise(resolve => setTimeout(resolve, whoisDelay));
|
|
430
432
|
} else if (whoisDelay > 0) {
|
|
431
433
|
// Add initial delay on first attempt if configured
|
|
432
434
|
if (debugMode) {
|
|
@@ -437,6 +439,13 @@ async function whoisLookupWithRetry(domain, timeout = 10000, whoisServer = null,
|
|
|
437
439
|
}
|
|
438
440
|
}
|
|
439
441
|
await new Promise(resolve => setTimeout(resolve, whoisDelay));
|
|
442
|
+
} else if (debugMode) {
|
|
443
|
+
// Log when delay is skipped due to whoisDelay being 0
|
|
444
|
+
if (logFunc) {
|
|
445
|
+
logFunc(`${messageColors.highlight('[whois-retry]')} Skipping delay (whoisDelay: ${whoisDelay}ms)`);
|
|
446
|
+
} else {
|
|
447
|
+
console.log(formatLogMessage('debug', `${messageColors.highlight('[whois-retry]')} Skipping delay (whoisDelay: ${whoisDelay}ms)`));
|
|
448
|
+
}
|
|
440
449
|
}
|
|
441
450
|
|
|
442
451
|
try {
|
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
|
-
//
|
|
342
|
-
const
|
|
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
|
-
|
|
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.
|
|
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.
|
|
133
|
+
const VERSION = '2.0.19'; // Script version
|
|
134
134
|
|
|
135
135
|
// get startTime
|
|
136
136
|
const startTime = Date.now();
|
|
@@ -2555,7 +2555,7 @@ function setupFrameHandling(page, forceDebug) {
|
|
|
2555
2555
|
const netToolsHandler = createNetToolsHandler({
|
|
2556
2556
|
whoisTerms,
|
|
2557
2557
|
whoisOrTerms,
|
|
2558
|
-
whoisDelay: siteConfig.whois_delay
|
|
2558
|
+
whoisDelay: siteConfig.whois_delay !== undefined ? siteConfig.whois_delay : whois_delay,
|
|
2559
2559
|
whoisServer,
|
|
2560
2560
|
whoisServerMode: siteConfig.whois_server_mode || whois_server_mode,
|
|
2561
2561
|
debugLogFile,
|
|
@@ -2662,7 +2662,7 @@ function setupFrameHandling(page, forceDebug) {
|
|
|
2662
2662
|
const netToolsHandler = createNetToolsHandler({
|
|
2663
2663
|
whoisTerms,
|
|
2664
2664
|
whoisOrTerms,
|
|
2665
|
-
whoisDelay: siteConfig.whois_delay
|
|
2665
|
+
whoisDelay: siteConfig.whois_delay !== undefined ? siteConfig.whois_delay : whois_delay, // Site-specific or global fallback
|
|
2666
2666
|
whoisServer, // Pass whois server configuration
|
|
2667
2667
|
whoisServerMode: siteConfig.whois_server_mode || whois_server_mode,
|
|
2668
2668
|
debugLogFile, // Pass debug log file for whois error logging
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanboynz/network-scanner",
|
|
3
|
-
"version": "2.0.
|
|
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": {
|