This script will fully automate the purchase of all Hacknet upgrades in the fastest method possible. The fastest method is exponential returns awarded through selecting the cheapest upgrade at all times, therefore making your money work for you faster. Determine the cheapest upgrade, wait for funds, purchase, rinse and repeat.
Note: RAM Usage is 5.7GB
Create ES5 Script
While inside the Bitburner Terminal create a new script by typing the following:
Example: nano hacknet_infinite.script
Note: This script requires 5.7GB of memory available
Copy the contents of the script and save them into the new script file you just created.
After saving the script you can run it by typing:
Example: run hacknet_infinity.script
Under the Hood
This script iterates through all upgrade options sets flags for the cheapest option and waits until there are enough funds to purchase.
Currently, it does not utilize the quantity function, as the cheapest option is always to purchase in single units to get your money working for you faster under the passive income method. This is why the variable Qty is set to 1 and not overwritten in the loop.
If you read through the Hacknet API on the official website there is an example script that uses a value of 10 when purchasing basic levels for Nodes. IMO buying single units will net you more money in the long run due to exponential returns from the smaller purchases of single levels.
P.S This is not Asynchronous as there is no benefit in multi-threading this task. No matter how many resources you have your bottleneck is the bank balance. Therefore implementation through .script is not only appropriate it is optimal as it makes use of less memory-intensive commands.