Inspired by this basic auto farm, automate all servers with improved performances.
Avis
Note: Require at least 8.1G on your ‘maison’ serveur.
Créer un ‘runner.js’ file on your home server, paste the content below on it then run it.
nano runner.js
Par défaut, this script will not kill all other services running on each server. You can enforce it by running
run runner.js --kill
This script will use all your personally owned servers. The more you have, the more it’ll be efficient.
Scénario
/** @param {Ns} ns **/ export async function main(ns) { ns.disableLog('ALL'); ns.enableLog('print'); var options = ns.flags([ ['kill', FAUX], ['hack', FAUX], ['grow', FAUX], ['weaken', FAUX], ['waitTime', 10], ['help', FAUX] ]); si (choix['help']) { ns.tail(); ns.print(`Auto-script, choix: * --tuer: Force kill every other process on every servers * --hack some-script.js: Replace hack script with some-script.js one * --grow some-script.js: Replace grow script with some-script.js one * --weaken some-script.js: Replace weaken script with some-script.js one * --waitTime 10: Wait time between two servers in ms, must be higher than 1 * --aide: show this message `); retour; } // Creating scripts var hack = options['hack'] || '/temp/hack.js', grow = options['grow'] || '/temp/grow.js', weaken = options['weaken'] || '/temp/weaken.js'; si (!choix['hack']) { await ns.write(pirater, ` /** @param {Ns} ns **/ export async function main(ns) { await ns.hack(ns.args[0]); } `, 'w'); } si (!choix['grow']) { await ns.write(grandir, ` /** @param {Ns} ns **/ export async function main(ns) { await ns.grow(ns.args[0]); } `, 'w'); } si (!choix['weaken']) { await ns.write(affaiblir, ` /** @param {Ns} ns **/ export async function main(ns) { await ns.weaken(ns.args[0]); } `, 'w'); } // Divs variables declarations var serverList = ns.scan('home'), serverCount = [serverList.length, 0], softwares = [0, 0, 0, 0, 0, 0], softwaresCount = 0, scanLevel = 2, index = 0, notProxyList = [], proxyList = ['home'], hackables = [], growables = [], weakenables = [], linked, cible, proxyTarget, depth = 0, checked = 0, hackType; // Checking softwares if (Ns.Fileexistes('BruteSSH.exe')) { softwares[0] = 1; softwaresCount++; }; si (Ns.Fileexistes('FTPCrack.exe')) { softwares[1] = 1; softwaresCount++; }; si (Ns.Fileexistes('relaySMTP.exe')) { softwares[2] = 1; softwaresCount++; }; si (Ns.Fileexistes('HTTPWorm.exe')) { softwares[3] = 1; softwaresCount++; }; si (Ns.Fileexistes('SQLInject.exe')) { softwares[4] = 1; softwaresCount++; }; si (Ns.Fileexistes('DeepscanV1.exe')) { scanLevel += 2; }; si (Ns.Fileexistes('DeepscanV2.exe')) { scanLevel += 5; }; ns.print('/---/ SEARCHING \\---\\\n-- Default --\n > ' + serverList.join('\n > ') + '\n>- Scan Limit: L' + [scanLevel + 1] + ' -<'); alors que (index <= serverCount[depth] - 1 && depth < scanLevel) { linked = ns.scan(serverList[à carreaux]); checked++; pour (let index = 0; index <= linked.length - 1; index++) { target = linked[index]; si (cible != 'home' && !serverList.includes(cible)) { serverList.push(cible); ns.print('L' + [depth + 2] + ' > ' + cible); serverCount[depth + 1]++; } } si (index == serverCount[depth] - 1) { index = 0; depth++; serverCount.push(0); } autre { index++; }; } ns.print('/-------/ CHECKING \\-------\\'); pour (let index = 0; index <= serverList.length - 1; index++) { target = serverList[index]; si (ns.getPurchasedServers().comprend(cible)) { attendre ns.scp([pirater, grandir, affaiblir], 'home', cible); si (choix['kill']) { ns.killall(cible); } proxyList.push(cible); ns.print(' >>> PROXY ' + cible); } Sinon si (ns.getServerNumportsRequired(cible) > softwaresCount) { ns.print(' >X< SOFTWARE ' + cible); } Sinon si (ns.getServerMaxram(cible) < 2) { ns.print(' >X< NO RAM ' + cible); } Sinon si (ns.gethackinglevel() < ns.getServerRequiredHackingLevel(cible)) { ns.print(' >X< SKILL ' + cible); } autre { si (softwares[0]) { ns.brutessh(cible); }; si (softwares[1]) { ns.ftpcrack(cible); }; si (softwares[2]) { ns.relaysmtp(cible); }; si (softwares[3]) { ns.httpworm(cible); }; si (softwares[4]) { ns.sqlinject(cible); }; ns.nuke(cible); attendre ns.scp([pirater, grandir, affaiblir], 'home', cible); si (choix['kill']) { ns.killall(cible); } si (ns.getServerMoneyAvailable(cible) == 0) { ns.print(' >X< NO MONEY ' + cible); proxyList.push(cible); ns.print(' >>> PROXY ' + cible); } autre { notProxyList.push(cible); ns.print(' >>> VALID ' + cible); } } } si (notProxyList.length > 0) { ns.print('/------------/ HACKING \\------------\\'); alors que (vrai) { hackables = []; growables = []; weakenables = []; pour (target of notProxyList) { // Priority for targets: affaiblir, then grow, then hack if (ns.getServersecuritylevel(cible) > ns.getServerMinSecurityLevel(cible) + 5) { hackType = weaken; weakenables.push(cible); } Sinon si (ns.getServerMoneyAvailable(cible) < ns.getServerMaxMoney(cible) * 0.80) { hackType = grow; growables.push(cible); } autre { hackType = hack; hackables.push(cible); } si ((ns.getServerMaxram(cible) - ns.getServerUsedRam(cible)) > ns.getscripTram(hackType)) { ns.exec(hackType, cible, Math.floor((ns.getServerMaxram(cible) - ns.getServerUsedRam(cible)) / ns.getscripTram(hackType)), cible); ns.print('|||||||||| ' + hackType + ' --> ' + cible + ' ||||||||||'); } } pour (target of proxyList) { // Priority for proxies: pirater, then grow, then weaken if (hackables.length > 0) { proxyTarget = hackables[Math.floor(Math.random() * hackables.length)]; hackType = hack; } Sinon si (growables.length > 0) { proxyTarget = growables[Math.floor(Math.random() * growables.length)]; hackType = grow; } Sinon si (weakenables.length > 0) { proxyTarget = weakenables[Math.floor(Math.random() * weakenables.length)]; hackType = weaken; } si ((ns.getServerMaxram(cible) - ns.getServerUsedRam(cible)) > ns.getscripTram(hackType)) { ns.exec(hackType, cible, Math.floor((ns.getServerMaxram(cible) - ns.getServerUsedRam(cible)) / ns.getscripTram(hackType)), proxyTarget); ns.print('|||||||||| proxy --> ' + cible + ' --> ' + hackType + ' --> ' + proxyTarget + ' ||||||||||'); } } // Await n ms between each servers to avoid issue with the infinite loop await ns.sleep(choix['waitTime']); } } autre { ns.print('Error, no server available.'); } }
Advanced Usage
You can see all options in-game with
run runner.js --help
You are allowed to use your own hack, grandir, weaken script. You can also customize the waiting time between each server. Avertissement. Always use more that 1ms or you’ll freeze your game.
C'est tout ce que nous partageons aujourd'hui pour cela Brûleur de bits guide. Ce guide a été initialement créé et rédigé par Nekotorep. Si nous ne parvenons pas à mettre à jour ce guide, vous pouvez trouver la dernière mise à jour en suivant ceci lien.
As of release 2.0.1, the last two arguments of the scp function need to be flipped. C'est gagné’t throw errors, mais toi’ll find that it will only be using the home computer to run the grow/weaken/hack cycle.