Auto self server hack/weaken/grow worm “BUNGAWORM” – Bitburner

Auto self server hack/weaken/grow worm “BUNGAWORM” – Bitburner 1 - steamclue.com
Auto self server hack/weaken/grow worm “BUNGAWORM” – Bitburner 1 - steamclue.com

Worm script that starts at home, gathers available servers to connect to, adds them to a pool of servers to check in next loop, and installs hack weaken and grow scripts to run on itself, then repeats.
 
 
Hopefully with all the comments and simplifying (could probably be simplified even more) the flow of reading this code, you should be able to understand what variable affects what and how to dynamically work this script for your own use.
 
 
Requires one hack script and 3 “stabilize” (grow and weaken), scripts on home. Run bungaworm.script on home.
 
 

Intro

Hi, I learned to code from bitburner in 20 hours and this is my original worm script written by free hand in 30 hours and vomited profusely when I was done. Probably some errors and dumb mistakes in here but she works beautifully.
 
 
Dont hurt my girl.
 
 
 

Bungaworm.script

disableLog(“disableLog”);
 
disableLog(“getPurchasedServers”);
 
disableLog(“getServerRequiredHackingLevel”);
 
disableLog(“getHackingLevel”);
 
var servers = []; //servers is an array of each server connected to the home network
 
var target = [];
 
var scripts = [‘nuke’, ‘brutessh’, ‘ftpcrack’, ‘relaysmtp’, ‘httpworm’, ‘sqlinject’];
 
var childservers = [];
 
var purchasedservers = [];
 
//Initialize
 
purchasedservers = getPurchasedServers();
 
servers = (scan(“home”));
 
servers.length = servers.length – purchasedservers.length;
 
print(“player owned servers removed from server pool: “, purchasedservers);
 
print(“Returned “, servers.length, ” servers”);
 
servers = [];
 
servers[0] = “home”;
 
print(servers.length);
 
//while program is on
 
while (true) {
 
 
sleep(3000)
 
//list all servers in main server pool
 
print(“X/X/X/X/X/X/X/X/INITIATE MAIN LOOP”, “\\X\\X\\X\\X\\X\\X\\X\\X”);
 
//initial loop that sets which main server in server pool to check
 
//continues until iterations of loops is greater than length of number of servers in main server pool
 
for (var i = 0; i < (servers.length); i++) {
 
//skip checking if main server to be checked is home again
 
if (servers == “null”) {
 
continue;
 
}
 
if (servers == “undefined”) {
 
continue;
 
}
 
//next server in total server array marked for target and the child servers of target are put into childservers array
 
print(” v-SERVER POOL-v”)
 
print(“—————————————————“);
 
print(servers);
 
print(“—————————————————“);
 
target[0] = (servers);
 
 
if (target[0] == “home”) {
 
childservers = scan(target[0]);
 
childservers.length = (childservers.length – purchasedservers.length);
 
}
 
else {
 
childservers = scan(target[0]);
 
}
 
print(target[0] + “<———————(TARGET)”);
 
//first nested loop that selects the first server in the child server pool to be checked against every already aquired server in the server pool
 
//continues until there are no more child servers to be checked then returns to initial loop to target the next main server
 
cs = 0;
 
for (var ms = 0, cs; cs < childservers.length; cs++) {
 
ms = 0;
 
print(“gathering child servers of target for “, (cs + 1), ” times”)
 
sleep(3000)
 
print(“__________________________________________________”);
 
print(” child collection: “, “(“, target[0], “)>>”, childservers);
 
print(“||||||||||||||||||||||||||||||||||||||||||||||||||||| “, (cs + 1), “/”, (servers.length), ” ||”)
 
// checks if the current child server array pos is greater than the array itself
 
if (cs > childservers.length)
 
print(“childserver posistion target greater than available childserver posistions”);
 
else {
 
//second nested loop that checks the current targeted child server against every main server to add or reject-
 
//-new child servers to the server pool and return to first nested loop to check the next child server to be checked
 
for (var ms = ms, cs = cs; ms <= servers.length; ms++) {
 
print(“||”, childservers[cs], “||============||”, servers[ms], “||”);
 
// if the child server being checked is; not home, not null, not a duplicate and the loop is at the end of checking the current-
 
//-childserver against every main server in the server pool then it is added to an array of new child servers and those are added to the main server array
 
if (getServerRequiredHackingLevel(childservers[cs]) <= getHackingLevel() && (childservers[cs]) != “home” && childservers[cs] != “null” && childservers[cs] != servers[ms] && ms == servers.length) {
 
print(” !!!!PASS!!!!”)
 
servers[ms] = (childservers[cs])
 
print(” ADDED – “, childservers[cs])
 
sleep(3000)
 
print(“||||||||||||||||||~~PLUGGIN’ IN~~||||||||||||||||||”)
 
brutessh(childservers[cs]);
 
//ftpcrack(childservers[cs]);
 
//relaysmtp(childservers[cs]);
 
//httpworm(childservers[cs]);
 
//sqlinject(childservers[cs]);
 
nuke(childservers[cs]);
 
//installBackdoor(childservers[cs]); //wait till later game to initialize
 
//ifs that check invalid childservers and rejects them back to checking the next child server to be checked
 
if (hasRootAccess(childservers[cs]) == true) {
 
print(childservers[cs], ” HAS BEEN cracked”);
 
if (getServerMaxMoney(childservers[cs]) == 0) {
 
print(“Broke a*s no money havin a*s server”)
 
break;
 
}
 
//MIN SERVER SIZE TO INTERACT WITH |||||| SET THIS HIGHER MID GAME RUN TO PREVENT LESS PROFITABLE SERVERS FROM CLUTTERING ACTIVE SCRIPTS ||||||
 
if (getServerMaxRam(childservers[cs]) <= 8) {
 
print(“server ram too small”);
 
kill(“bungahack.script”, childservers[cs]);
 
kill(“bungastable.script”, childservers[cs]);
 
kill(“bungastable1.script”, childservers[cs]);
 
kill(“bungastable2.script”, childservers[cs]);
 
break;
 
}
 
 
//copy/run hack and stabalize scripts on non invalid childservers
 
else {
 
if (fileExists(“bungahack.script”, childservers[cs]) == false) {
 
scp(“bungahack.script”, “home”, childservers[cs]);
 
}
 
else {
 
print(“hacker already on server”)
 
}
 
if (scriptRunning(“bungahack.script”, childservers[cs]) == false) {
 
exec(“bungahack.script”, childservers[cs], ((((getServerMaxRam(childservers[cs])) – (getServerUsedRam(childservers[cs]))) * 0.05) / getScriptRam(“bungahack.script”) + 1), childservers[cs]);
 
}
 
else {
 
print(“hacker already running on server”)
 
}
 
if (scriptRunning(“bungahack.script”, childservers[cs]) == true) {
 
print(“hacker install PASS”);
 
}

 
 
 

Bungaworm.script (cont.)

else {
 
print(“hacker install FAIL”);
 
}
 
if (fileExists(“bungastable.script”, childservers[cs]) == false) {
 
scp(“bungastable.script”, “home”, childservers[cs]);
 
}
 
else {
 
print(“stable already on server”)
 
}
 
if (scriptRunning(“bungastable.script”, childservers[cs]) == false) {
 
exec(“bungastable.script”, childservers[cs], (((getServerMaxRam(childservers[cs])) – (getServerUsedRam(childservers[cs]))) / getScriptRam(“bungastable.script”) / 3), childservers[cs]);
 
}
 
else {
 
print(“stable already running on server”)
 
}
 
if (scriptRunning(“bungastable.script”, childservers[cs]) == true) {
 
print(“stable install PASS”);
 
}
 
else {
 
print(“stable install FAIL”);
 
}
 
if (fileExists(“bungastable1.script”, childservers[cs]) == false) {
 
scp(“bungastable1.script”, “home”, childservers[cs]);
 
}
 
else {
 
print(“stable1 already on server”)
 
}
 
if (scriptRunning(“bungastable1.script”, childservers[cs]) == false) {
 
exec(“bungastable1.script”, childservers[cs], ((((getServerMaxRam(childservers[cs])) – (getServerUsedRam(childservers[cs])))) / getScriptRam(“bungastable1.script”) / 2), childservers[cs]);
 
}
 
else {
 
print(“stable1 already running on server”)
 
}
 
if (scriptRunning(“bungastable1.script”, childservers[cs]) == true) {
 
print(“stable1 install PASS”);
 
}
 
else {
 
print(“stable1 install FAIL”);
 
}
 
if (fileExists(“bungastable2.script”, childservers[cs]) == false) {
 
scp(“bungastable2.script”, “home”, childservers[cs]);
 
}
 
else {
 
print(“stable2 already on server”)
 
}
 
if (scriptRunning(“bungastable2.script”, childservers[cs]) == false) {
 
exec(“bungastable2.script”, childservers[cs], ((((getServerMaxRam(childservers[cs])) – (getServerUsedRam(childservers[cs])))) / getScriptRam(“bungastable2.script”) + 1), childservers[cs]);
 
}
 
if (scriptRunning(“bungastable2.script”, childservers[cs]) == false) {
 
exec(“bungastable2.script”, childservers[cs], ((((getServerMaxRam(childservers[cs])) – (getServerUsedRam(childservers[cs])))) / getScriptRam(“bungastable2.script”)), childservers[cs]);
 
}
 
if (scriptRunning(“bungastable2.script”, childservers[cs]) == false) {
 
exec(“bungastable2.script”, childservers[cs], ((((getServerMaxRam(childservers[cs])) – (getServerUsedRam(childservers[cs])))) / getScriptRam(“bungastable2.script”) – 1), childservers[cs]);
 
}
 
else {
 
print(“stable2 already running on server”)
 
}
 
if (scriptRunning(“bungastable2.script”, childservers[cs]) == true) {
 
print(“stable2 install PASS”);
 
}
 
else {
 
print(“stable2 install FAIL”);
 
}
 
}
 
}
 
else {
 
print(childservers[cs], ” HAS NOT been cracked”)
 
}
 
}
 
if (childservers[cs] == “home”) {
 
print(“skip home”)
 
break;
 
}
 
if (childservers[cs] == servers[ms]) {
 
print(“is duplicate”)
 
break;
 
}
 
if (childservers[cs] == “null”) {
 
print(“is null”)
 
break;
 
}
 
if (getServerRequiredHackingLevel(childservers[cs]) > getHackingLevel()) {
 
print(“CHILD SERVER LEVEL TOO HIGH / GIT GOOD”)
 
break;
 
}
 
else
 
continue;
 
}
 
}
 
}
 
sleep(3000);
 
}
 
}
 
 
 

Bungahack.script

// hack script
 
var target = args[0];
 
var moneyThresh = getServerMaxMoney(target) * 0.75;
 
var securityThresh = getServerMinSecurityLevel(target) + 6;
 
while (true) {
 
if ((getServerSecurityLevel(target) < securityThresh)
 
& (getServerMoneyAvailable(target) > moneyThresh)) {
 
hack(target);
 
}
 
}
 
 
Auto self server hack/weaken/grow worm
 
 
 

Bungastable.script (bungastable.script, bungastable1.script, bungastable2.script)

// weaken and grow script
 
var target = args[0];
 
var moneyThresh = getServerMaxMoney(target) * 0.90;
 
var securityThresh = getServerMinSecurityLevel(target) + 3;
 
while (true) {
 
if (getServerSecurityLevel(target) > securityThresh) {
 
weaken(target);
 
} else {
 
grow(target);
 
}
 
}
 
 
//MAKE THREE OF THESE AND NAME THEM bungastable, bungastable1 and bungastable2 (.script)
 
 
Auto self server hack/weaken/grow worm
 
 

 
 
I hope you enjoy the Auto self server hack/weaken/grow worm “BUNGAWORM” – Bitburner guide. This is all for now! If you have something to add to this guide or forget to add some information, please let us know via comment! We check each comment manually!
 


Be the first to comment

Leave a Reply

Your email address will not be published.


*