-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeetchOneServer.js
More file actions
30 lines (27 loc) · 858 Bytes
/
Copy pathLeetchOneServer.js
File metadata and controls
30 lines (27 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/** @param {NS} ns **/
;
async function LeetchServer(ns) {
const serverList = ns.scan();
for (let x = 0; x < serverList.length; x++) {
ns.print("Copy Scripts to " + serverList[x])
await ns.run('CopyScriptsToServer.js', 1, serverList[x]);
await ns.sleep(250);
ns.exec('master.js', serverList[x], CalcThreads(ns, serverList[x]), ns.args[0]);
}
}
export async function main(ns) {
ns.disableLog("exec");
ns.disableLog("sleep");
ns.disableLog("run");
ns.disableLog("brutessh");
ns.disableLog("nuke");
ns.disableLog("killall");
ns.disableLog("getServerMaxRam");
ns.clearLog();
await LeetchServer(ns);
}
function CalcThreads(ns, Host) {
let ScriptRam = ns.getScriptRam("master.js")
let ServerRam = ns.getServerMaxRam(Host)
return (ServerRam / ScriptRam).toFixed(0) - 1
}