@fanboynz/network-scanner 1.0.78 → 1.0.80
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/README.md +13 -5
- package/lib/interaction.js +28 -9
- package/nwss.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -351,20 +351,28 @@ node nwss.js --max-concurrent 12 --cleanup-interval 300 -o rules.txt
|
|
|
351
351
|
|
|
352
352
|
## INSTALL
|
|
353
353
|
|
|
354
|
-
|
|
354
|
+
#### (Ubuntu as example). NOTE: Use Chrome and not Chromium for best compatibility.
|
|
355
355
|
|
|
356
|
-
|
|
356
|
+
#### Add Google's signing key
|
|
357
|
+
```
|
|
357
358
|
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg
|
|
359
|
+
```
|
|
358
360
|
|
|
359
|
-
|
|
361
|
+
#### Add Google Chrome repository
|
|
362
|
+
```
|
|
360
363
|
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
|
|
364
|
+
```
|
|
361
365
|
|
|
362
|
-
|
|
366
|
+
#### Update and install
|
|
367
|
+
```
|
|
363
368
|
sudo apt update
|
|
364
369
|
sudo apt install google-chrome-stable
|
|
370
|
+
```
|
|
365
371
|
|
|
366
|
-
|
|
372
|
+
#### dig & whois (needed for network checks)
|
|
373
|
+
```
|
|
367
374
|
sudo apt install bind9-dnsutils whois
|
|
375
|
+
```
|
|
368
376
|
|
|
369
377
|
## Notes
|
|
370
378
|
|
package/lib/interaction.js
CHANGED
|
@@ -82,9 +82,9 @@ const MOUSE_MOVEMENT = {
|
|
|
82
82
|
MAX_STEPS: 30, // Maximum steps to prevent excessive slowness
|
|
83
83
|
MIN_DELAY: 5, // Minimum milliseconds between movement steps
|
|
84
84
|
MAX_DELAY: 25, // Maximum milliseconds between movement steps
|
|
85
|
-
DEFAULT_CURVE: 0.
|
|
85
|
+
DEFAULT_CURVE: 0.2, // Default curve intensity (reduced for performance)
|
|
86
86
|
DEFAULT_JITTER: 2, // Default random jitter in pixels
|
|
87
|
-
DISTANCE_STEP_RATIO:
|
|
87
|
+
DISTANCE_STEP_RATIO: 50, // Pixels per step (FIXED: increased from 10 to prevent excessive steps)
|
|
88
88
|
CURVE_INTENSITY_RATIO: 0.01 // Multiplier for curve calculation
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -335,10 +335,29 @@ async function humanLikeMouseMove(page, fromX, fromY, toX, toY, options = {}) {
|
|
|
335
335
|
} = options;
|
|
336
336
|
|
|
337
337
|
const distance = Math.sqrt((toX - fromX) ** 2 + (toY - fromY) ** 2);
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
)
|
|
338
|
+
|
|
339
|
+
// FIXED: More aggressive step capping to prevent excessive delays
|
|
340
|
+
let actualSteps;
|
|
341
|
+
if (options.steps) {
|
|
342
|
+
// Use explicit steps parameter but cap at MAX_STEPS
|
|
343
|
+
actualSteps = Math.min(options.steps, MOUSE_MOVEMENT.MAX_STEPS);
|
|
344
|
+
} else {
|
|
345
|
+
// Calculate steps based on distance with strict limits
|
|
346
|
+
const calculatedSteps = Math.floor(distance / MOUSE_MOVEMENT.DISTANCE_STEP_RATIO);
|
|
347
|
+
actualSteps = Math.max(
|
|
348
|
+
MOUSE_MOVEMENT.MIN_STEPS,
|
|
349
|
+
Math.min(calculatedSteps, MOUSE_MOVEMENT.MAX_STEPS)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// FIXED: Add performance safeguard - never exceed 2 seconds total
|
|
354
|
+
const maxTotalTime = 2000; // 2 seconds maximum
|
|
355
|
+
const estimatedTime = actualSteps * maxDelay;
|
|
356
|
+
if (estimatedTime > maxTotalTime) {
|
|
357
|
+
actualSteps = Math.floor(maxTotalTime / maxDelay);
|
|
358
|
+
// Optional: Log performance cap without forceDebug dependency
|
|
359
|
+
// console.log(`[interaction] Capped steps to ${actualSteps} to prevent timeout (estimated: ${estimatedTime}ms)`);
|
|
360
|
+
}
|
|
342
361
|
|
|
343
362
|
for (let i = 0; i <= actualSteps; i++) {
|
|
344
363
|
const progress = i / actualSteps;
|
|
@@ -838,8 +857,8 @@ async function performPageInteraction(page, currentUrl, options = {}, forceDebug
|
|
|
838
857
|
});
|
|
839
858
|
|
|
840
859
|
await humanLikeMouseMove(page, currentPos.x, currentPos.y, targetPos.x, targetPos.y, {
|
|
841
|
-
|
|
842
|
-
|
|
860
|
+
steps: 8 + Math.floor(Math.random() * 10), // FIXED: Reduced step range (was 10-25, now 8-18)
|
|
861
|
+
curve: 0.1 + Math.random() * 0.2, // FIXED: Reduced curve intensity
|
|
843
862
|
jitter: 1 + Math.random() * 2
|
|
844
863
|
});
|
|
845
864
|
|
|
@@ -1003,7 +1022,7 @@ function createInteractionConfig(url, siteConfig = {}) {
|
|
|
1003
1022
|
if (hostname.includes('news') || hostname.includes('blog')) {
|
|
1004
1023
|
config.includeScrolling = true;
|
|
1005
1024
|
config.intensity = 'high';
|
|
1006
|
-
config.duration = SITE_DURATIONS.NEWS_BLOG;
|
|
1025
|
+
config.duration = Math.min(SITE_DURATIONS.NEWS_BLOG, 4000); // FIXED: Cap at 4 seconds
|
|
1007
1026
|
} else if (hostname.includes('shop') || hostname.includes('store')) {
|
|
1008
1027
|
config.includeElementClicks = false; // Avoid accidental purchases
|
|
1009
1028
|
config.intensity = 'low';
|
package/nwss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// === Network scanner script (nwss.js) v1.0.
|
|
1
|
+
// === Network scanner script (nwss.js) v1.0.80 ===
|
|
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.80'; // Script version
|
|
127
127
|
|
|
128
128
|
// get startTime
|
|
129
129
|
const startTime = Date.now();
|
|
@@ -471,7 +471,7 @@ Global config.json options:
|
|
|
471
471
|
ignore_similar_threshold: 80 Similarity threshold percentage for ignore_similar (default: 80)
|
|
472
472
|
ignore_similar_ignored_domains: true/false Ignore domains similar to ignoreDomains list (default: true)
|
|
473
473
|
max_concurrent_sites: 8 Maximum concurrent site processing (1-50, default: 8)
|
|
474
|
-
resource_cleanup_interval:
|
|
474
|
+
resource_cleanup_interval: 80 Browser restart interval in URLs processed (1-1000, default: 80)
|
|
475
475
|
|
|
476
476
|
Per-site config.json options:
|
|
477
477
|
url: "site" or ["site1", "site2"] Single URL or list of URLs
|
|
@@ -607,7 +607,7 @@ const {
|
|
|
607
607
|
ignore_similar_threshold = 80,
|
|
608
608
|
ignore_similar_ignored_domains = true,
|
|
609
609
|
max_concurrent_sites = 6,
|
|
610
|
-
resource_cleanup_interval =
|
|
610
|
+
resource_cleanup_interval = 80,
|
|
611
611
|
comments: globalComments,
|
|
612
612
|
...otherGlobalConfig
|
|
613
613
|
} = config;
|
|
@@ -652,12 +652,12 @@ const RESOURCE_CLEANUP_INTERVAL = (() => {
|
|
|
652
652
|
if (typeof resource_cleanup_interval === 'number' && resource_cleanup_interval > 0 && resource_cleanup_interval <= 1000) {
|
|
653
653
|
if (forceDebug) console.log(formatLogMessage('debug', `Using config resource_cleanup_interval: ${resource_cleanup_interval}`));
|
|
654
654
|
return resource_cleanup_interval;
|
|
655
|
-
} else if (resource_cleanup_interval !==
|
|
656
|
-
console.warn(`⚠ Invalid config resource_cleanup_interval value: ${resource_cleanup_interval}. Using default:
|
|
655
|
+
} else if (resource_cleanup_interval !== 80) {
|
|
656
|
+
console.warn(`⚠ Invalid config resource_cleanup_interval value: ${resource_cleanup_interval}. Using default: 80`);
|
|
657
657
|
}
|
|
658
658
|
|
|
659
659
|
// Use default
|
|
660
|
-
return
|
|
660
|
+
return 80;
|
|
661
661
|
})();
|
|
662
662
|
|
|
663
663
|
// Perform cache clear after config is loaded for custom cache paths
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanboynz/network-scanner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.80",
|
|
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": {
|