generated from Dicken/dickendock
round53: Timeout-Berechnung fuer masscan/httpx auf ganze Zahl runden (execFile lehnte Kommawerte ab)
This commit is contained in:
@@ -76,7 +76,10 @@ function computeTimeoutMs(targetCount: number, threads: number, perProbeTimeoutS
|
|||||||
const perProbeSeconds = perProbeTimeoutSec * (1 + retries);
|
const perProbeSeconds = perProbeTimeoutSec * (1 + retries);
|
||||||
const estimatedSeconds = (targetCount / threads) * perProbeSeconds;
|
const estimatedSeconds = (targetCount / threads) * perProbeSeconds;
|
||||||
const withMargin = estimatedSeconds * 1.5 + 10;
|
const withMargin = estimatedSeconds * 1.5 + 10;
|
||||||
return Math.min(Math.max(withMargin * 1000, 30_000), 10 * 60_000);
|
// Math.round() analog zu masscan.ts: auch wenn Node's setTimeout() Floats
|
||||||
|
// technisch toleriert, bleibt der Wert so konsistent nachvollziehbar
|
||||||
|
// (ganze Sekunden in den Log-/Fehlermeldungen weiter oben).
|
||||||
|
return Math.round(Math.min(Math.max(withMargin * 1000, 30_000), 10 * 60_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -97,7 +97,11 @@ function computeTimeoutMs(hostCount: number, portRange: string, rate: number): n
|
|||||||
const totalProbes = hostCount * countPortsInRange(portRange);
|
const totalProbes = hostCount * countPortsInRange(portRange);
|
||||||
const estimatedSeconds = totalProbes / rate;
|
const estimatedSeconds = totalProbes / rate;
|
||||||
const withMargin = estimatedSeconds * 2 + 15;
|
const withMargin = estimatedSeconds * 2 + 15;
|
||||||
return Math.min(Math.max(withMargin * 1000, 60_000), 15 * 60_000);
|
// Math.round() ist Pflicht: execFile()s "timeout"-Option verlangt eine
|
||||||
|
// ganze Zahl (Node validiert das strikt) - estimatedSeconds ist aus einer
|
||||||
|
// Division entstanden und damit fast immer eine Kommazahl, die sonst mit
|
||||||
|
// "The value of "timeout" is out of range" abgelehnt wird.
|
||||||
|
return Math.round(Math.min(Math.max(withMargin * 1000, 60_000), 15 * 60_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user