This commit is contained in:
2023-08-29 03:50:21 +02:00
parent af84e9b05f
commit 673abd49b2
9 changed files with 133 additions and 130 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
} }
], ],
"settings": { "settings": {
"bitburner.authToken": "iQitq5P5Qm+bzKxz8I3KQow1tOfRtZByqcdIP9H8b2aEmwsznA9osU5xHdgJnyUt", "bitburner.authToken": "P0tylWtZUP/26SeH6U8pl1jhOrcsXN5gLfGkqnE5mRWn11Yusyy0VyY9bYBFK1kw",
"bitburner.fileWatcher.enable": true, "bitburner.fileWatcher.enable": true,
"bitburner.showFileWatcherEnabledNotification": false, "bitburner.showFileWatcherEnabledNotification": false,
"bitburner.showPushSuccessNotification": false, "bitburner.showPushSuccessNotification": false,
+2 -2
View File
@@ -121,9 +121,9 @@ export async function main(ns) {
return [currentServer].concat(result); return [currentServer].concat(result);
} }
while(true){ while (true) {
let network = scanServer('home'); let network = scanServer('home');
await sleep(100); await ns.sleep(100);
} }
} }
+7
View File
@@ -0,0 +1,7 @@
/** @param {import(".").NS } ns */
export async function main(ns) {
// ns.disableLog('ALL');
}
+16 -1
View File
@@ -9,10 +9,25 @@ export const EXCLUDE_SERVERS = [
'run4theh111z' 'run4theh111z'
]; ];
for (let index = 0; index < 25; index++) { for (let index = 0; index < 1024; index++) {
EXCLUDE_SERVERS.push(`home-${index}`); EXCLUDE_SERVERS.push(`home-${index}`);
} }
const DARKWEB_PROGRAMS = [
{ name: 'BruteSSH.exe', cost: 0 },
{ name: 'FTPCrack.exe', cost: 1500000 },
{ name: 'relaySMTP.exe', cost: 5000000 },
{ name: 'HTTPWorm.exe', cost: 30000000 },
{ name: 'SQLInject.exe', cost: 250000000 },
{ name: 'ServerProfiler.exe', cost: 500000 },
{ name: 'DeepscanV1.exe', cost: 500000 },
{ name: 'DeepscanV2.exe', cost: 25000000 },
{ name: 'AutoLink.exe', cost: 1000000 },
{ name: 'Formulas.exe', cost: 5000000000 }
];
const COMPLETED_FACTIONS = [ const COMPLETED_FACTIONS = [
'CyberSec', 'CyberSec',
'Netburners', 'Netburners',
+5 -65
View File
@@ -3,77 +3,22 @@
export async function main(ns) { export async function main(ns) {
ns.disableLog('ALL'); ns.disableLog('ALL');
const nodeCostThreshold = ns.args.length > 0 ? ns.args[0] : 0.8; const nodeCostThreshold = ns.args.length > 0 ? ns.args[0] : 0.2;
const upgradeCostThreshold = ns.args.length > 1 ? ns.args[1] : 0.1; const upgradeCostThreshold = ns.args.length > 1 ? ns.args[1] : 0.1;
const upgradeCount = ns.args.length > 2 ? ns.args[2] : 1; const upgradeCount = ns.args.length > 2 ? ns.args[2] : 1;
const nodeCap = 18; const helperBuyThreshold = ns.args.length > 3 ? ns.args[3] : 0.2;
const nodeCap = 200;
const levelCap = 200; const levelCap = 200;
const ramCap = 64; const ramCap = 64;
const coreCap = 16; const coreCap = 16;
const serverRAM = 32; const serverRAM = 32;
// const levelCap = 150;
// const ramCap = 64;
// const coreCap = 4;
ns.tprint(`Bot started {nodeCostThreshold: ${nodeCostThreshold}, upgradeCostThreshold: ${upgradeCostThreshold}, upgradeCount: ${upgradeCount}}`); ns.tprint(`Bot started {nodeCostThreshold: ${nodeCostThreshold}, upgradeCostThreshold: ${upgradeCostThreshold}, upgradeCount: ${upgradeCount}}`);
// const terminalInput = document.getElementById("terminal-input");
// const handler = Object.keys(terminalInput)[1];
const darkWebPrograms = [
{ name: 'BruteSSH.exe', cost: 0 },
{ name: 'FTPCrack.exe', cost: 1500000 },
{ name: 'relaySMTP.exe', cost: 5000000 },
{ name: 'HTTPWorm.exe', cost: 30000000 },
{ name: 'SQLInject.exe', cost: 250000000 },
{ name: 'ServerProfiler.exe', cost: 500000 },
{ name: 'DeepscanV1.exe', cost: 500000 },
{ name: 'DeepscanV2.exe', cost: 25000000 },
{ name: 'AutoLink.exe', cost: 1000000 },
{ name: 'Formulas.exe', cost: 5000000000 }
];
const HACKNET_UPGRADE_PATTERN = {
currentLevel: 0,
upgradeLevels: [
{
nodeCount: 6,
nodeLevel: 30,
ram: 4,
cores: 1
},
{
nodeCount: 9,
nodeLevel: 60,
ram: 8,
cores: 2
},
{
nodeCount: 12,
nodeLevel: 60,
ram: 8,
cores: 2
},
{
nodeCount: 15,
nodeLevel: 150,
ram: 16,
cores: 6
},
{
nodeCount: 18,
nodeLevel: 200,
ram: 64,
cores: 16
}
],
complete: false
};
while (true) {
while (true) { while (true) {
let currentMoney = ns.getServerMoneyAvailable("home"); let currentMoney = ns.getServerMoneyAvailable("home");
if (!HACKNET_UPGRADE_PATTERN.complete) {
let nodePurchaseCost = ns.hacknet.getPurchaseNodeCost(); let nodePurchaseCost = ns.hacknet.getPurchaseNodeCost();
let nodeCount = ns.hacknet.numNodes(); let nodeCount = ns.hacknet.numNodes();
@@ -101,25 +46,21 @@ export async function main(ns) {
currentMoney = ns.getServerMoneyAvailable("home"); currentMoney = ns.getServerMoneyAvailable("home");
} }
} }
}
let serverCost = ns.getPurchasedServerCost(serverRAM); let serverCost = ns.getPurchasedServerCost(serverRAM);
if (serverCost < currentMoney) { if (serverCost < currentMoney * helperBuyThreshold) {
let newServer = ns.purchaseServer('home', serverRAM); let newServer = ns.purchaseServer('home', serverRAM);
if (newServer != '') { if (newServer != '') {
ns.tprint(`Bought a server`); ns.tprint(`Bought a server`);
ns.scp('grow-helper.js', newServer); ns.scp('grow-helper.js', newServer);
ns.scp('constants.js', newServer); ns.scp('constants.js', newServer);
let execExitCode = ns.exec('grow-helper.js', newServer, 5, 20); let execExitCode = ns.exec('grow-helper.js', newServer, 10, 20);
ns.tprint(`Exec 'grow-helper.js' exit code: ${execExitCode}`); ns.tprint(`Exec 'grow-helper.js' exit code: ${execExitCode}`);
} }
} }
// terminalInput.value = backdoorCommand;
// terminalInput[handler].onChange({ target: terminalInput });
// terminalInput[handler].onKeyDown({ key: 'Enter', preventDefault: () => null });
let logFiles = ['hack-log.js', 'nuke-log.js']; let logFiles = ['hack-log.js', 'nuke-log.js'];
@@ -132,5 +73,4 @@ export async function main(ns) {
await ns.sleep(1000); await ns.sleep(1000);
} }
}
} }
+13
View File
@@ -0,0 +1,13 @@
/** @param {import(".").NS } ns */
export async function main(ns) {
ns.disableLog('ALL');
for (let server = 0; ns.serverExists(`home-${server}`); server++) {
ns.scriptKill('grow-helper.js', `home-${server}`);
}
}
File diff suppressed because one or more lines are too long
+31
View File
@@ -0,0 +1,31 @@
/** @param {import(".").NS } ns */
import { EXCLUDE_SERVERS } from "./constants.js";
export async function main(ns) {
ns.disableLog('ALL');
/**
* Recursively kill simple-hack.js running on servers in the network
* @async
* @param {string} currentServer server to scan
*/
function scanServer(currentServer, previousServer = currentServer, connectString = '', scanLevel = 0) {
let availableServers = ns.scan(currentServer);
let nextConnectString = connectString + `connect ${currentServer}; `;
ns.tprint(`${'┃ '.repeat(scanLevel)}${currentServer}: ${nextConnectString}`);
ns.write('scan.txt', `${'┃ '.repeat(scanLevel)}┣━${currentServer}: ${nextConnectString}`+'\n', 'a');
for (let i = 0; i < availableServers.length; ++i) {
let nextServer = availableServers[i];
if (nextServer != currentServer && nextServer != previousServer) {
scanServer(nextServer, currentServer, nextConnectString, scanLevel+1);
}
}
}
ns.tprint(`Running scan`);
ns.write('scan.txt', ``, 'w');
scanServer('home');
}
+2 -6
View File
@@ -3,12 +3,8 @@
export async function main(ns) { export async function main(ns) {
ns.disableLog('ALL'); ns.disableLog('ALL');
for (let server = 0; server <= ns.args[0]; server++) { for (let server = 0; ns.serverExists(`home-${server}`); server++) {
ns.scp('grow-helper.js', `home-${server}`, 'home'); ns.scp('grow-helper.js', `home-${server}`, 'home');
ns.exec('grow-helper.js', `home-${server}`, 5, 20); ns.exec('grow-helper.js', `home-${server}`, 10);
} }
} }