@fanboynz/network-scanner 1.0.98 → 2.0.1
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/browserhealth.js +5 -4
- package/lib/output.js +2 -2
- package/nwss.js +5 -5
- package/package.json +2 -2
package/lib/browserhealth.js
CHANGED
|
@@ -7,8 +7,9 @@ const { formatLogMessage, messageColors } = require('./colorize');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// Window cleanup delay constant
|
|
10
|
-
const WINDOW_CLEANUP_DELAY_MS =
|
|
11
|
-
|
|
10
|
+
const WINDOW_CLEANUP_DELAY_MS = 15000;
|
|
11
|
+
// window_clean REALTIME
|
|
12
|
+
const REALTIME_CLEANUP_BUFFER_MS = 15000; // Additional buffer time after site delay. Delay increased to fix missing hits.
|
|
12
13
|
const REALTIME_CLEANUP_THRESHOLD = 8; // Default number of pages to keep
|
|
13
14
|
const REALTIME_CLEANUP_MIN_PAGES = 3; // Minimum pages before cleanup kicks in
|
|
14
15
|
|
|
@@ -18,7 +19,7 @@ let pageCreationCounter = 0;
|
|
|
18
19
|
|
|
19
20
|
// Track page usage for realtime cleanup safety
|
|
20
21
|
const pageUsageTracker = new Map(); // Maps page -> { lastActivity: timestamp, isProcessing: boolean }
|
|
21
|
-
const PAGE_IDLE_THRESHOLD =
|
|
22
|
+
const PAGE_IDLE_THRESHOLD = 15000; // 15 seconds of inactivity before considering page safe to clean
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Performs group-level window cleanup after all URLs in a site group complete
|
|
@@ -990,4 +991,4 @@ if (originalPageClose) {
|
|
|
990
991
|
}
|
|
991
992
|
return originalPageClose.apply(this, args);
|
|
992
993
|
};
|
|
993
|
-
}
|
|
994
|
+
}
|
package/lib/output.js
CHANGED
|
@@ -80,7 +80,7 @@ function extractDomainFromRule(rule) {
|
|
|
80
80
|
} else if (rule.startsWith('{ +block } .')) {
|
|
81
81
|
// Privoxy format: { +block } .domain.com
|
|
82
82
|
return rule.substring(12);
|
|
83
|
-
} else if (rule.match(/^\(
|
|
83
|
+
} else if (rule.match(/^\(\^\|\\\.\)/)) {
|
|
84
84
|
// Pi-hole regex format: (^|\.)domain\.com$
|
|
85
85
|
return rule.replace(/^\(\^\|\\?\.\)/, '').replace(/\\\./g, '.').replace(/\$$/, '');
|
|
86
86
|
}
|
|
@@ -660,4 +660,4 @@ module.exports = {
|
|
|
660
660
|
mapResourceTypeToAdblockModifier,
|
|
661
661
|
matchesIgnoreDomain,
|
|
662
662
|
extractDomainFromRule
|
|
663
|
-
};
|
|
663
|
+
};
|
package/nwss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// === Network scanner script (nwss.js)
|
|
1
|
+
// === Network scanner script (nwss.js) v2.0.0 ===
|
|
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
|
|
@@ -127,7 +127,7 @@ const { navigateWithRedirectHandling, handleRedirectTimeout } = require('./lib/r
|
|
|
127
127
|
const { monitorBrowserHealth, isBrowserHealthy, isQuicklyResponsive, performGroupWindowCleanup, performRealtimeWindowCleanup, trackPageForRealtime, updatePageUsage } = require('./lib/browserhealth');
|
|
128
128
|
|
|
129
129
|
// --- Script Configuration & Constants ---
|
|
130
|
-
const VERSION = '
|
|
130
|
+
const VERSION = '2.0.0'; // Script version
|
|
131
131
|
|
|
132
132
|
// get startTime
|
|
133
133
|
const startTime = Date.now();
|
|
@@ -1876,9 +1876,9 @@ function setupFrameHandling(page, forceDebug) {
|
|
|
1876
1876
|
let curlUserAgent = '';
|
|
1877
1877
|
if (useCurl && siteConfig.userAgent) {
|
|
1878
1878
|
const userAgents = {
|
|
1879
|
-
chrome: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
1880
|
-
firefox: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:
|
|
1881
|
-
safari: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.
|
|
1879
|
+
chrome: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
|
|
1880
|
+
firefox: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0",
|
|
1881
|
+
safari: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15"
|
|
1882
1882
|
};
|
|
1883
1883
|
curlUserAgent = userAgents[siteConfig.userAgent.toLowerCase()] || '';
|
|
1884
1884
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanboynz/network-scanner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lru-cache": "^10.4.3",
|
|
14
14
|
"p-limit": "^4.0.0",
|
|
15
15
|
"psl": "^1.15.0",
|
|
16
|
-
"puppeteer": ">=20.0.0
|
|
16
|
+
"puppeteer": ">=20.0.0"
|
|
17
17
|
},
|
|
18
18
|
"overrides": {
|
|
19
19
|
"tar-fs": "3.1.0",
|