1
0
mirror of https://gitlab.com/MisterBiggs/bitburner-scripts.git synced 2025-08-03 12:01:32 +00:00

first redpill

This commit is contained in:
2021-12-28 17:26:21 -07:00
parent f731b8038d
commit 864154d233
4 changed files with 135 additions and 36 deletions

File diff suppressed because one or more lines are too long

2
scripts/botnet.js Normal file
View File

@@ -0,0 +1,2 @@
run("spider.script");
spawn("hn.script");

86
scripts/hn.js Normal file
View File

@@ -0,0 +1,86 @@
function myMoney() {
return getServerMoneyAvailable("home");
}
disableLog("getServerMoneyAvailable");
disableLog("sleep");
threads = Math.max(
1,
Math.floor(
(getServerMaxRam("home") - getServerUsedRam("home")) /
getScriptRam("advhack.script")
)
);
run("advhack.script", threads);
var cnt = 8;
while (hacknet.numNodes() < cnt) {
res = hacknet.purchaseNode();
print("Purchased hacknet Node with index " + res);
}
for (var i = 0; i < cnt; i++) {
while (hacknet.getNodeStats(i).level <= 80) {
var cost = hacknet.getLevelUpgradeCost(i, 10);
while (myMoney() < cost) {
print("Need $" + cost + " . Have $" + myMoney());
sleep(3000);
}
res = hacknet.upgradeLevel(i, 10);
}
}
tprint("All nodes upgraded to level 80");
for (var i = 0; i < cnt; i++) {
while (hacknet.getNodeStats(i).ram < 16) {
var cost = hacknet.getRamUpgradeCost(i, 2);
while (myMoney() < cost) {
print("Need $" + cost + " . Have $" + myMoney());
sleep(3000);
}
res = hacknet.upgradeRam(i, 2);
}
}
tprint("All nodes upgraded to 16GB RAM");
for (var i = 0; i < cnt; i++) {
while (hacknet.getNodeStats(i).cores < 8) {
var cost = hacknet.getCoreUpgradeCost(i, 1);
while (myMoney() < cost) {
print("Need $" + cost + " . Have $" + myMoney());
sleep(3000);
}
res = hacknet.upgradeCore(i, 1);
}
}
tprint("All nodes upgraded to 8 cores");
tprint("===Hacknet Nodes Complete===");
ram = 1024;
hn = "pserv-";
for (i = 0; i < getPurchasedServerLimit(); ++i) {
var cost = getPurchasedServerCost(ram);
while (myMoney() < cost) {
print("Need $" + cost + " . Have $" + myMoney());
sleep(30000);
}
purchaseServer(hn + i, ram);
tprint(hn + i, " added to swarm.");
}
scriptKill("advhack.script", "home");
threads = Math.max(
1,
Math.floor(
(getServerMaxRam("home") -
getServerUsedRam("home") +
getScriptRam("hn.script")) /
getScriptRam("advhack.script")
)
);
spawn("advhack.script", threads);

View File

@@ -14,7 +14,8 @@ while (i < servers.length) {
} }
scp(script, servers[i]); scp(script, servers[i]);
if (!hasRootAccess(servers[i])) {
// dont hack purchased servers
if (getServerNumPortsRequired(servers[i])) { if (getServerNumPortsRequired(servers[i])) {
while (!fileExists("BruteSSH.exe")) { while (!fileExists("BruteSSH.exe")) {
sleep(20000); sleep(20000);
@@ -22,6 +23,7 @@ while (i < servers.length) {
brutessh(servers[i]); brutessh(servers[i]);
} }
nuke(servers[i]); nuke(servers[i]);
}
threads = Math.max( threads = Math.max(
1, 1,
@@ -59,6 +61,8 @@ while (true) {
continue; continue;
} }
if (!hasRootAccess(tonuke[i])) {
// dont hack purchased servers
ports = 0; ports = 0;
if (fileExists("BruteSSH.exe")) { if (fileExists("BruteSSH.exe")) {
brutessh(tonuke[i]); brutessh(tonuke[i]);
@@ -84,9 +88,9 @@ while (true) {
i++; i++;
continue; continue;
} }
// ftpcrack(tonuke[i]); // ftpcrack(tonuke[i]);
nuke(tonuke[i]); nuke(tonuke[i]);
}
scp(script, tonuke[i]); scp(script, tonuke[i]);
@@ -97,9 +101,16 @@ while (true) {
); );
exec(script, tonuke[i], threads); exec(script, tonuke[i], threads);
nuked.push(tonuke[i]); nuked.push(tonuke[i]);
tprint(tonuke[i], " added to botnet with ", threads, " threads"); tprint(
tonuke[i],
" added to botnet with ",
threads,
" threads. Server has $",
getServerMoneyAvailable(tonuke[i]) / 1e6
),
"M";
i++; i++;
} }
sleep(20000); sleep(2000);
} }
tprint("===== SPIDER FINISHED ====="); tprint("===== SPIDER FINISHED =====");