@fanboynz/network-scanner 1.0.73 → 1.0.75
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/nwss.js +65 -3
- package/package.json +1 -1
package/nwss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// === Network scanner script (nwss.js) v1.0.
|
|
1
|
+
// === Network scanner script (nwss.js) v1.0.75 ===
|
|
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.
|
|
126
|
+
const VERSION = '1.0.75'; // Script version
|
|
127
127
|
|
|
128
128
|
// get startTime
|
|
129
129
|
const startTime = Date.now();
|
|
@@ -2111,7 +2111,51 @@ 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
|
+
// Call nettools handler BEFORE exiting
|
|
2118
|
+
if (hasNetTools && !hasSearchString && !hasSearchStringAnd) {
|
|
2119
|
+
// Create and execute nettools handler
|
|
2120
|
+
const netToolsHandler = createNetToolsHandler({
|
|
2121
|
+
whoisTerms,
|
|
2122
|
+
whoisOrTerms,
|
|
2123
|
+
whoisDelay: siteConfig.whois_delay || whois_delay,
|
|
2124
|
+
whoisServer,
|
|
2125
|
+
whoisServerMode: siteConfig.whois_server_mode || whois_server_mode,
|
|
2126
|
+
debugLogFile,
|
|
2127
|
+
fs,
|
|
2128
|
+
digTerms,
|
|
2129
|
+
digOrTerms,
|
|
2130
|
+
digRecordType,
|
|
2131
|
+
digSubdomain: siteConfig.dig_subdomain === true,
|
|
2132
|
+
dryRunCallback: dryRunMode ? createEnhancedDryRunCallback(matchedDomains, forceDebug) : null,
|
|
2133
|
+
matchedDomains,
|
|
2134
|
+
addMatchedDomain,
|
|
2135
|
+
isDomainAlreadyDetected,
|
|
2136
|
+
onWhoisResult: smartCache ? (domain, result) => smartCache.cacheNetTools(domain, 'whois', result) : undefined,
|
|
2137
|
+
onDigResult: smartCache ? (domain, result, recordType) => smartCache.cacheNetTools(domain, 'dig', result, recordType) : undefined,
|
|
2138
|
+
cachedWhois: smartCache ? smartCache.getCachedNetTools(reqDomain, 'whois') : null,
|
|
2139
|
+
cachedDig: smartCache ? smartCache.getCachedNetTools(reqDomain, 'dig', digRecordType) : null,
|
|
2140
|
+
currentUrl,
|
|
2141
|
+
getRootDomain,
|
|
2142
|
+
siteConfig,
|
|
2143
|
+
dumpUrls,
|
|
2144
|
+
matchedUrlsLogFile,
|
|
2145
|
+
forceDebug,
|
|
2146
|
+
fs
|
|
2147
|
+
});
|
|
2148
|
+
|
|
2149
|
+
// Execute nettools check asynchronously
|
|
2150
|
+
const originalDomain = fullSubdomain;
|
|
2151
|
+
setImmediate(() => netToolsHandler(reqDomain, originalDomain));
|
|
2152
|
+
}
|
|
2153
|
+
if (forceDebug) {
|
|
2154
|
+
console.log(formatLogMessage('debug', `${reqUrl} has nettools validation required - skipping immediate add`));
|
|
2155
|
+
}
|
|
2156
|
+
request.continue();
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2115
2159
|
|
|
2116
2160
|
// If NO searchstring AND NO nettools are defined, match immediately (existing behavior)
|
|
2117
2161
|
if (!hasSearchString && !hasSearchStringAnd && !hasNetTools) {
|
|
@@ -2152,6 +2196,12 @@ function setupFrameHandling(page, forceDebug) {
|
|
|
2152
2196
|
console.log(formatLogMessage('debug', `${reqUrl} matched regex ${matchedRegexPattern} and resourceType ${resourceType}, queued for nettools check`));
|
|
2153
2197
|
}
|
|
2154
2198
|
|
|
2199
|
+
// IMPORTANT: Do NOT add domain immediately when nettools validation is required
|
|
2200
|
+
// The nettools handler will add the domain only if validation passes
|
|
2201
|
+
if (forceDebug) {
|
|
2202
|
+
console.log(formatLogMessage('debug', `Domain ${reqDomain} queued for mandatory nettools validation (dig: ${JSON.stringify(siteConfig.dig)})`));
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2155
2205
|
if (dryRunMode) {
|
|
2156
2206
|
// For dry run, we'll collect the domain for nettools checking
|
|
2157
2207
|
matchedDomains.get('dryRunMatches').push({
|
|
@@ -2212,6 +2262,12 @@ function setupFrameHandling(page, forceDebug) {
|
|
|
2212
2262
|
// Execute nettools check asynchronously
|
|
2213
2263
|
const originalDomain = fullSubdomain; // Use full subdomain for nettools
|
|
2214
2264
|
setImmediate(() => netToolsHandler(reqDomain, originalDomain));
|
|
2265
|
+
|
|
2266
|
+
// Do NOT continue processing this request for immediate domain addition
|
|
2267
|
+
// The nettools handler is responsible for adding the domain if validation passes
|
|
2268
|
+
if (forceDebug) {
|
|
2269
|
+
console.log(formatLogMessage('debug', `Request processing halted for ${reqUrl} - awaiting nettools validation`));
|
|
2270
|
+
}
|
|
2215
2271
|
} else {
|
|
2216
2272
|
// If searchstring or searchstring_and IS defined (with or without nettools), queue for content checking
|
|
2217
2273
|
// Skip searchstring check if full subdomain was already detected
|
|
@@ -2237,6 +2293,12 @@ function setupFrameHandling(page, forceDebug) {
|
|
|
2237
2293
|
needsSearchStringCheck: true
|
|
2238
2294
|
});
|
|
2239
2295
|
}
|
|
2296
|
+
// If we have BOTH searchstring AND nettools, ensure nettools validation still happens
|
|
2297
|
+
if (hasNetTools) {
|
|
2298
|
+
if (forceDebug) {
|
|
2299
|
+
console.log(formatLogMessage('debug', `${reqUrl} requires both content and nettools validation`));
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2240
2302
|
}
|
|
2241
2303
|
|
|
2242
2304
|
// 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.
|
|
3
|
+
"version": "1.0.75",
|
|
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": {
|