hackAnalyzeThreads() Netscript Function¶
-
hackAnalyzeThreads
(hostname/ip, hackAmount)¶ Arguments: - hostname/ip (string) – IP or hostname of server to analyze
- hackAmount (number) – Amount of money you want to hack from the server
Returns: The number of threads needed to hack() the server for hackAmount money
RAM cost: 1 GB
This function returns the number of script threads you need when running the hack() command to steal the specified amount of money from the target server.
If hackAmount is less than zero or greater than the amount of money available on the server, then this function returns -1.
For example, let’s say the foodnstuff server has $10m and you run:
hackAnalyzeThreads("foodnstuff", 1e6);
If this function returns 50, this means that if your next hack() call is run on a script with 50 threads, it will steal $1m from the foodnstuff server.
Warning
The value returned by this function isn’t necessarily a whole number.
Warning
It is possible for this function to return
Infinity
orNaN
in certain uncommon scenarios. This is because in JavaScript:0 / 0 = NaN
N / 0 = Infinity
for 0 < N < Infinity.
For example, if a server has no money available and you want to hack some positive amount from it, then the function would return
Infinity
because this would be impossible.