@fanboynz/network-scanner 1.0.89 → 1.0.92
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/interaction.js +40 -18
- package/nwss.js +2 -2
- package/package.json +1 -1
package/lib/interaction.js
CHANGED
|
@@ -84,7 +84,7 @@ const MOUSE_MOVEMENT = {
|
|
|
84
84
|
MAX_DELAY: 25, // Maximum milliseconds between movement steps
|
|
85
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: 200, // CRITICAL: 4x increase to drastically reduce steps
|
|
88
88
|
CURVE_INTENSITY_RATIO: 0.01 // Multiplier for curve calculation
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -339,19 +339,19 @@ async function humanLikeMouseMove(page, fromX, fromY, toX, toY, options = {}) {
|
|
|
339
339
|
// FIXED: More aggressive step capping to prevent excessive delays
|
|
340
340
|
let actualSteps;
|
|
341
341
|
if (options.steps) {
|
|
342
|
-
//
|
|
343
|
-
actualSteps = Math.min(options.steps,
|
|
342
|
+
// CRITICAL: Much lower step cap to prevent timeouts
|
|
343
|
+
actualSteps = Math.min(options.steps, 8); // Was MAX_STEPS (30), now max 8
|
|
344
344
|
} else {
|
|
345
345
|
// Calculate steps based on distance with strict limits
|
|
346
346
|
const calculatedSteps = Math.floor(distance / MOUSE_MOVEMENT.DISTANCE_STEP_RATIO);
|
|
347
347
|
actualSteps = Math.max(
|
|
348
|
-
|
|
349
|
-
Math.min(calculatedSteps,
|
|
348
|
+
2, // Min 2 steps instead of 5
|
|
349
|
+
Math.min(calculatedSteps, 6) // Max 6 steps instead of 30
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
//
|
|
354
|
-
const maxTotalTime =
|
|
353
|
+
// CRITICAL: Emergency timeout - never exceed 300ms for mouse movement
|
|
354
|
+
const maxTotalTime = 300; // 300ms maximum (was 2000ms)
|
|
355
355
|
const estimatedTime = actualSteps * maxDelay;
|
|
356
356
|
if (estimatedTime > maxTotalTime) {
|
|
357
357
|
actualSteps = Math.floor(maxTotalTime / maxDelay);
|
|
@@ -787,6 +787,14 @@ async function performPageInteraction(page, currentUrl, options = {}, forceDebug
|
|
|
787
787
|
} = options;
|
|
788
788
|
|
|
789
789
|
try {
|
|
790
|
+
// CRITICAL: Emergency timeout wrapper for entire interaction
|
|
791
|
+
const MAX_INTERACTION_TIME = 15000; // 15 seconds absolute maximum
|
|
792
|
+
const interactionStartTime = Date.now();
|
|
793
|
+
|
|
794
|
+
const checkTimeout = () => {
|
|
795
|
+
return Date.now() - interactionStartTime > MAX_INTERACTION_TIME;
|
|
796
|
+
};
|
|
797
|
+
|
|
790
798
|
// Validate page state before starting interaction
|
|
791
799
|
try {
|
|
792
800
|
// Optimized timeout calculation - shorter for better performance
|
|
@@ -845,20 +853,26 @@ async function performPageInteraction(page, currentUrl, options = {}, forceDebug
|
|
|
845
853
|
return; // Exit gracefully if mouse operations fail
|
|
846
854
|
}
|
|
847
855
|
|
|
848
|
-
|
|
856
|
+
|
|
849
857
|
const totalDuration = duration * settings.pauseMultiplier;
|
|
850
|
-
|
|
858
|
+
// CRITICAL: Cap action intervals to prevent long waits
|
|
859
|
+
const baseInterval = totalDuration / (actualMovements + (includeScrolling ? settings.scrolls : 0));
|
|
860
|
+
const actionInterval = Math.min(baseInterval, 100); // Never wait more than 100ms
|
|
861
|
+
|
|
862
|
+
// Start timing ONLY the actual interaction operations
|
|
863
|
+
const actualInteractionStartTime = Date.now();
|
|
851
864
|
|
|
852
865
|
// Perform mouse movements
|
|
853
866
|
for (let i = 0; i < actualMovements; i++) {
|
|
867
|
+
if (checkTimeout()) break; // Emergency timeout check
|
|
854
868
|
const targetPos = generateRandomCoordinates(maxX, maxY, {
|
|
855
869
|
avoidCenter: i % 2 === 0,
|
|
856
870
|
preferEdges: i % 3 === 0
|
|
857
871
|
});
|
|
858
872
|
|
|
859
873
|
await humanLikeMouseMove(page, currentPos.x, currentPos.y, targetPos.x, targetPos.y, {
|
|
860
|
-
steps:
|
|
861
|
-
curve: 0.
|
|
874
|
+
steps: 3 + Math.floor(Math.random() * 4), // CRITICAL: 3-6 steps (was 8-18)
|
|
875
|
+
curve: 0.05 + Math.random() * 0.05, // CRITICAL: Minimal curve
|
|
862
876
|
jitter: 1 + Math.random() * 2
|
|
863
877
|
});
|
|
864
878
|
|
|
@@ -866,24 +880,25 @@ async function performPageInteraction(page, currentUrl, options = {}, forceDebug
|
|
|
866
880
|
|
|
867
881
|
// Occasional pause
|
|
868
882
|
if (Math.random() < PROBABILITIES.PAUSE_CHANCE) {
|
|
869
|
-
await fastTimeout(
|
|
883
|
+
await fastTimeout(25 + Math.random() * 50); // CRITICAL: Much shorter pauses
|
|
870
884
|
}
|
|
871
885
|
|
|
872
886
|
// Time-based spacing
|
|
873
|
-
await fastTimeout(actionInterval);
|
|
887
|
+
await fastTimeout(Math.min(actionInterval, 50)); // CRITICAL: Cap at 50ms
|
|
874
888
|
}
|
|
875
889
|
|
|
876
890
|
// Scrolling simulation
|
|
877
891
|
if (includeScrolling) {
|
|
878
892
|
for (let i = 0; i < settings.scrolls; i++) {
|
|
893
|
+
if (checkTimeout()) break; // Emergency timeout check
|
|
879
894
|
const direction = Math.random() < PROBABILITIES.SCROLL_DOWN_BIAS ? 'down' : 'up';
|
|
880
895
|
await simulateScrolling(page, {
|
|
881
896
|
direction,
|
|
882
|
-
amount:
|
|
883
|
-
smoothness:
|
|
897
|
+
amount: 1 + Math.floor(Math.random() * 2), // CRITICAL: Less scrolling
|
|
898
|
+
smoothness: 1 + Math.floor(Math.random() * 2) // CRITICAL: Much less smooth
|
|
884
899
|
});
|
|
885
900
|
|
|
886
|
-
await fastTimeout(actionInterval);
|
|
901
|
+
await fastTimeout(Math.min(actionInterval, 100)); // CRITICAL: Cap intervals
|
|
887
902
|
}
|
|
888
903
|
}
|
|
889
904
|
|
|
@@ -912,9 +927,16 @@ async function performPageInteraction(page, currentUrl, options = {}, forceDebug
|
|
|
912
927
|
// Silently handle hover failures - not critical
|
|
913
928
|
}
|
|
914
929
|
|
|
915
|
-
|
|
930
|
+
// End timing ONLY after actual interaction operations complete
|
|
931
|
+
const interactionElapsedTime = Date.now() - actualInteractionStartTime
|
|
932
|
+
|
|
933
|
+
// CRITICAL: Warn about slow interactions
|
|
934
|
+
if (interactionElapsedTime > 8000) {
|
|
935
|
+
console.warn(`[interaction] WARNING: Interaction took ${interactionElapsedTime}ms for ${currentUrl}`);
|
|
936
|
+
}
|
|
937
|
+
|
|
916
938
|
if (forceDebug) {
|
|
917
|
-
console.log(`[interaction] Completed interaction simulation in ${
|
|
939
|
+
console.log(`[interaction] Completed interaction simulation in ${interactionElapsedTime}ms (${actualMovements} movements, ${includeScrolling ? settings.scrolls : 0} scrolls)`);
|
|
918
940
|
}
|
|
919
941
|
|
|
920
942
|
} catch (interactionErr) {
|
package/nwss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// === Network scanner script (nwss.js) v1.0.
|
|
1
|
+
// === Network scanner script (nwss.js) v1.0.91 ===
|
|
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
|
|
@@ -125,7 +125,7 @@ const { navigateWithRedirectHandling, handleRedirectTimeout } = require('./lib/r
|
|
|
125
125
|
const { monitorBrowserHealth, isBrowserHealthy, isQuicklyResponsive } = require('./lib/browserhealth');
|
|
126
126
|
|
|
127
127
|
// --- Script Configuration & Constants ---
|
|
128
|
-
const VERSION = '1.0.
|
|
128
|
+
const VERSION = '1.0.91'; // Script version
|
|
129
129
|
|
|
130
130
|
// get startTime
|
|
131
131
|
const startTime = Date.now();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanboynz/network-scanner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.92",
|
|
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": {
|