1
0
mirror of https://gitlab.com/MisterBiggs/bitburner-scripts.git synced 2025-06-15 14:46:45 +00:00

first redpill

This commit is contained in:
Anson 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,14 +14,16 @@ while (i < servers.length) {
}
scp(script, servers[i]);
if (getServerNumPortsRequired(servers[i])) {
while (!fileExists("BruteSSH.exe")) {
sleep(20000);
if (!hasRootAccess(servers[i])) {
// dont hack purchased servers
if (getServerNumPortsRequired(servers[i])) {
while (!fileExists("BruteSSH.exe")) {
sleep(20000);
}
brutessh(servers[i]);
}
brutessh(servers[i]);
nuke(servers[i]);
}
nuke(servers[i]);
threads = Math.max(
1,
@ -59,34 +61,36 @@ while (true) {
continue;
}
ports = 0;
if (fileExists("BruteSSH.exe")) {
brutessh(tonuke[i]);
ports++;
if (!hasRootAccess(tonuke[i])) {
// dont hack purchased servers
ports = 0;
if (fileExists("BruteSSH.exe")) {
brutessh(tonuke[i]);
ports++;
}
if (fileExists("FTPCrack.exe")) {
ftpcrack(tonuke[i]);
ports++;
}
if (fileExists("relaySMTP.exe")) {
relaysmtp(tonuke[i]);
ports++;
}
if (fileExists("HTTPWorm.exe")) {
httpworm(tonuke[i]);
ports++;
}
if (fileExists("SQLInject.exe")) {
sqlinject(tonuke[i]);
ports++;
}
if (getServerNumPortsRequired(tonuke[i]) > ports) {
i++;
continue;
}
// ftpcrack(tonuke[i]);
nuke(tonuke[i]);
}
if (fileExists("FTPCrack.exe")) {
ftpcrack(tonuke[i]);
ports++;
}
if (fileExists("relaySMTP.exe")) {
relaysmtp(tonuke[i]);
ports++;
}
if (fileExists("HTTPWorm.exe")) {
httpworm(tonuke[i]);
ports++;
}
if (fileExists("SQLInject.exe")) {
sqlinject(tonuke[i]);
ports++;
}
if (getServerNumPortsRequired(tonuke[i]) > ports) {
i++;
continue;
}
// ftpcrack(tonuke[i]);
nuke(tonuke[i]);
scp(script, tonuke[i]);
@ -97,9 +101,16 @@ while (true) {
);
exec(script, tonuke[i], threads);
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++;
}
sleep(20000);
sleep(2000);
}
tprint("===== SPIDER FINISHED =====");