fixes
This commit is contained in:
@@ -76,6 +76,7 @@
|
|||||||
"avmnite",
|
"avmnite",
|
||||||
"brutessh",
|
"brutessh",
|
||||||
"CSEC",
|
"CSEC",
|
||||||
|
"Deepscan",
|
||||||
"dles",
|
"dles",
|
||||||
"ftpcrack",
|
"ftpcrack",
|
||||||
"Hacknet",
|
"Hacknet",
|
||||||
|
|||||||
+4
-7
@@ -1,4 +1,6 @@
|
|||||||
/** @param {import(".").NS } ns */
|
/** @param {import(".").NS } ns */
|
||||||
|
import { EXCLUDE_SERVERS } from "./constants.js";
|
||||||
|
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
|
|
||||||
@@ -176,12 +178,7 @@ export async function main(ns) {
|
|||||||
// await ns.sleep(10);
|
// await ns.sleep(10);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let excludeServers = ['home'];
|
|
||||||
for (let index = 0; index < 25; index++) {
|
|
||||||
excludeServers.push(`home-${index}`);
|
|
||||||
}
|
|
||||||
excludeServers.push('CSEC');
|
|
||||||
excludeServers.push('avmnite-02h');
|
|
||||||
/**
|
/**
|
||||||
* Recursively kill simple-hack.js running on servers in the network
|
* Recursively kill simple-hack.js running on servers in the network
|
||||||
* @async
|
* @async
|
||||||
@@ -194,7 +191,7 @@ export async function main(ns) {
|
|||||||
let nextServer = availableServers[i];
|
let nextServer = availableServers[i];
|
||||||
|
|
||||||
if (nextServer != currentServer && nextServer != previousServer) {
|
if (nextServer != currentServer && nextServer != previousServer) {
|
||||||
if (excludeServers.indexOf(nextServer) == -1) {
|
if (EXCLUDE_SERVERS.indexOf(nextServer) == -1) {
|
||||||
let hackExitCode = await runHack(nextServer);
|
let hackExitCode = await runHack(nextServer);
|
||||||
|
|
||||||
if (hackExitCode == 0) {
|
if (hackExitCode == 0) {
|
||||||
|
|||||||
+10
-4
@@ -34,6 +34,8 @@ export async function main(ns) {
|
|||||||
let targetPath = scanServer('home', ns.args[0]);
|
let targetPath = scanServer('home', ns.args[0]);
|
||||||
ns.tprint(targetPath);
|
ns.tprint(targetPath);
|
||||||
|
|
||||||
|
const terminalInput = document.getElementById("terminal-input");
|
||||||
|
const handler = Object.keys(terminalInput)[1];
|
||||||
let backdoorCommand = '';
|
let backdoorCommand = '';
|
||||||
|
|
||||||
for (let index = 1; index < targetPath.length; index++) {
|
for (let index = 1; index < targetPath.length; index++) {
|
||||||
@@ -41,18 +43,22 @@ export async function main(ns) {
|
|||||||
|
|
||||||
backdoorCommand += `connect ${server}; `;
|
backdoorCommand += `connect ${server}; `;
|
||||||
}
|
}
|
||||||
backdoorCommand += 'run BruteSSH.exe; ';
|
|
||||||
|
ns.tprint(backdoorCommand);
|
||||||
|
terminalInput.value = backdoorCommand;
|
||||||
|
terminalInput[handler].onChange({ target: terminalInput });
|
||||||
|
terminalInput[handler].onKeyDown({ key: 'Enter', preventDefault: () => null });
|
||||||
|
|
||||||
|
backdoorCommand = 'run BruteSSH.exe; ';
|
||||||
backdoorCommand += 'run FTPCrack.exe; ';
|
backdoorCommand += 'run FTPCrack.exe; ';
|
||||||
backdoorCommand += 'run relaySMTP.exe; ';
|
backdoorCommand += 'run relaySMTP.exe; ';
|
||||||
backdoorCommand += 'run HTTPWorm.exe; ';
|
backdoorCommand += 'run HTTPWorm.exe; ';
|
||||||
backdoorCommand += 'run SQLInject.exe; ';
|
backdoorCommand += 'run SQLInject.exe; ';
|
||||||
backdoorCommand += 'run NUKE.exe; ';
|
backdoorCommand += 'run NUKE.exe; ';
|
||||||
backdoorCommand += 'backdoor; home';
|
backdoorCommand += 'backdoor';
|
||||||
|
|
||||||
ns.tprint(backdoorCommand);
|
ns.tprint(backdoorCommand);
|
||||||
const terminalInput = document.getElementById("terminal-input");
|
|
||||||
terminalInput.value = backdoorCommand;
|
terminalInput.value = backdoorCommand;
|
||||||
const handler = Object.keys(terminalInput)[1];
|
|
||||||
terminalInput[handler].onChange({ target: terminalInput });
|
terminalInput[handler].onChange({ target: terminalInput });
|
||||||
terminalInput[handler].onKeyDown({ key: 'Enter', preventDefault: () => null });
|
terminalInput[handler].onKeyDown({ key: 'Enter', preventDefault: () => null });
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/** @param {import(".").NS } ns */
|
||||||
|
// import { EXCLUDE_SERVERS } from "./constants.js";
|
||||||
|
|
||||||
|
export const EXCLUDE_SERVERS = ['home'];
|
||||||
|
for (let index = 0; index < 25; index++) {
|
||||||
|
EXCLUDE_SERVERS.push(`home-${index}`);
|
||||||
|
}
|
||||||
|
EXCLUDE_SERVERS.push('CSEC');
|
||||||
|
EXCLUDE_SERVERS.push('avmnite-02h');
|
||||||
|
EXCLUDE_SERVERS.push('I.I.I.I');
|
||||||
|
|
||||||
|
const COMPLETED_FACTIONS = [
|
||||||
|
'CyberSec',
|
||||||
|
'Netburners',
|
||||||
|
'NiteSec'
|
||||||
|
];
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
CyberSec
|
CyberSec
|
||||||
Netburners
|
Netburners
|
||||||
|
NiteSec
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/** @param {import(".").NS } ns */
|
|
||||||
|
|
||||||
export async function main(ns) {
|
|
||||||
ns.disableLog('ALL');
|
|
||||||
|
|
||||||
async function writeLog(obj) {
|
|
||||||
await ns.tryWritePort(, obj + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
+3
-9
@@ -3,13 +3,7 @@
|
|||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// ns.disableLog('ALL');
|
// ns.disableLog('ALL');
|
||||||
|
|
||||||
let excludeServers = ['home'];
|
// TODO: add increasing threshold if no servers lower than current threshold
|
||||||
for (let index = 0; index < 25; index++) {
|
|
||||||
excludeServers.push(`home-${index}`);
|
|
||||||
}
|
|
||||||
excludeServers.push('CSEC');
|
|
||||||
excludeServers.push('avmnite-02h');
|
|
||||||
|
|
||||||
async function scanServer(currentServer, previousServer = currentServer) {
|
async function scanServer(currentServer, previousServer = currentServer) {
|
||||||
let availableServers = ns.scan(currentServer);
|
let availableServers = ns.scan(currentServer);
|
||||||
|
|
||||||
@@ -17,7 +11,7 @@ export async function main(ns) {
|
|||||||
let nextServer = availableServers[i];
|
let nextServer = availableServers[i];
|
||||||
|
|
||||||
if (nextServer != currentServer && nextServer != previousServer) {
|
if (nextServer != currentServer && nextServer != previousServer) {
|
||||||
if (excludeServers.indexOf(nextServer) == -1 && ns.scriptRunning('simple-hack.js', nextServer)) {
|
if (ns.scriptRunning('simple-hack.js', nextServer)) {
|
||||||
let maxMoney = ns.getServerMaxMoney(nextServer);
|
let maxMoney = ns.getServerMaxMoney(nextServer);
|
||||||
let currentMoney = ns.getServerMoneyAvailable(nextServer);
|
let currentMoney = ns.getServerMoneyAvailable(nextServer);
|
||||||
|
|
||||||
@@ -25,7 +19,7 @@ export async function main(ns) {
|
|||||||
await ns.grow(nextServer);
|
await ns.grow(nextServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await scanServer(nextServer, maxDepth, depth + 1, currentServer);
|
await scanServer(nextServer, currentServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+92
-26
@@ -3,42 +3,101 @@
|
|||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
|
|
||||||
let nodeCostThreshold = ns.args.length > 0 ? ns.args[0] : 0.1;
|
const nodeCostThreshold = ns.args.length > 0 ? ns.args[0] : 0.8;
|
||||||
let upgradeCostThreshold = ns.args.length > 1 ? ns.args[1] : 0.05;
|
const upgradeCostThreshold = ns.args.length > 1 ? ns.args[1] : 0.1;
|
||||||
let upgradeCount = ns.args.length > 2 ? ns.args[2] : 1;
|
const upgradeCount = ns.args.length > 2 ? ns.args[2] : 1;
|
||||||
let levelCap = 150;
|
const nodeCap = 18;
|
||||||
let ramCap = 64;
|
const levelCap = 200;
|
||||||
let coreCap = 4;
|
const ramCap = 64;
|
||||||
let nodeCap = 18;
|
const coreCap = 16;
|
||||||
|
// 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) {
|
||||||
let currentMoney = ns.getServerMoneyAvailable("home");
|
let currentMoney = ns.getServerMoneyAvailable("home");
|
||||||
let nodePurchaseCost = ns.hacknet.getPurchaseNodeCost();
|
|
||||||
let nodeCount = ns.hacknet.numNodes();
|
|
||||||
|
|
||||||
if (nodeCount < nodeCap && nodePurchaseCost / Math.abs(currentMoney) < nodeCostThreshold) {
|
if (!HACKNET_UPGRADE_PATTERN.complete) {
|
||||||
ns.hacknet.purchaseNode();
|
let nodePurchaseCost = ns.hacknet.getPurchaseNodeCost();
|
||||||
currentMoney = ns.getServerMoneyAvailable("home");
|
let nodeCount = ns.hacknet.numNodes();
|
||||||
++nodeCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let index = 0; index < nodeCount; ++index) {
|
if (nodeCount < nodeCap && nodePurchaseCost / Math.abs(currentMoney) < nodeCostThreshold) {
|
||||||
let nodeStats = ns.hacknet.getNodeStats(index);
|
ns.hacknet.purchaseNode();
|
||||||
|
|
||||||
if (nodeStats.level < levelCap && ns.hacknet.getLevelUpgradeCost(index, upgradeCount) / Math.abs(currentMoney) < upgradeCostThreshold) {
|
|
||||||
ns.hacknet.upgradeLevel(index, upgradeCount);
|
|
||||||
currentMoney = ns.getServerMoneyAvailable("home");
|
currentMoney = ns.getServerMoneyAvailable("home");
|
||||||
|
++nodeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeStats.ram < ramCap && ns.hacknet.getRamUpgradeCost(index, upgradeCount) / Math.abs(currentMoney) < upgradeCostThreshold) {
|
for (let index = 0; index < nodeCount; ++index) {
|
||||||
ns.hacknet.upgradeRam(index, upgradeCount);
|
let nodeStats = ns.hacknet.getNodeStats(index);
|
||||||
currentMoney = ns.getServerMoneyAvailable("home");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nodeStats.cores < coreCap && ns.hacknet.getCoreUpgradeCost(index, upgradeCount) / Math.abs(currentMoney) < upgradeCostThreshold) {
|
if (nodeStats.level < levelCap && ns.hacknet.getLevelUpgradeCost(index, upgradeCount) / Math.abs(currentMoney) < upgradeCostThreshold) {
|
||||||
ns.hacknet.upgradeCore(index, upgradeCount);
|
ns.hacknet.upgradeLevel(index, upgradeCount);
|
||||||
currentMoney = ns.getServerMoneyAvailable("home");
|
currentMoney = ns.getServerMoneyAvailable("home");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeStats.ram < ramCap && ns.hacknet.getRamUpgradeCost(index, upgradeCount) / Math.abs(currentMoney) < upgradeCostThreshold) {
|
||||||
|
ns.hacknet.upgradeRam(index, upgradeCount);
|
||||||
|
currentMoney = ns.getServerMoneyAvailable("home");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeStats.cores < coreCap && ns.hacknet.getCoreUpgradeCost(index, upgradeCount) / Math.abs(currentMoney) < upgradeCostThreshold) {
|
||||||
|
ns.hacknet.upgradeCore(index, upgradeCount);
|
||||||
|
currentMoney = ns.getServerMoneyAvailable("home");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,11 +108,18 @@ export async function main(ns) {
|
|||||||
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);
|
||||||
let execExitCode = ns.exec('grow-helper.js', newServer, 5, 20);
|
let execExitCode = ns.exec('grow-helper.js', newServer, 5, 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'];
|
||||||
|
|
||||||
for (let index = 0; index < logFiles.length; index++) {
|
for (let index = 0; index < logFiles.length; index++) {
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
/** @param {import(".").NS } ns */
|
/** @param {import(".").NS } ns */
|
||||||
|
import { EXCLUDE_SERVERS } from "./constants.js";
|
||||||
|
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
|
|
||||||
|
|
||||||
let excludeServers = ['home'];
|
|
||||||
for (let index = 0; index < 25; index++) {
|
|
||||||
excludeServers.push(`home-${index}`);
|
|
||||||
}
|
|
||||||
excludeServers.push('CSEC');
|
|
||||||
excludeServers.push('avmnite-02h');
|
|
||||||
/**
|
/**
|
||||||
* Recursively kill simple-hack.js running on servers in the network
|
* Recursively kill simple-hack.js running on servers in the network
|
||||||
* @async
|
* @async
|
||||||
@@ -22,7 +17,7 @@ export async function main(ns) {
|
|||||||
let nextServer = availableServers[i];
|
let nextServer = availableServers[i];
|
||||||
|
|
||||||
if (nextServer != currentServer && nextServer != previousServer) {
|
if (nextServer != currentServer && nextServer != previousServer) {
|
||||||
if (excludeServers.indexOf(nextServer) == -1) ns.scriptKill('simple-hack.js', nextServer);
|
if (EXCLUDE_SERVERS.indexOf(nextServer) == -1) ns.scriptKill('simple-hack.js', nextServer);
|
||||||
scanServer(nextServer, currentServer);
|
scanServer(nextServer, currentServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -48,7 +48,7 @@ export async function main(ns) {
|
|||||||
currentSecurity = ns.getServerSecurityLevel(server);
|
currentSecurity = ns.getServerSecurityLevel(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
await writeLog('LOG', `${server.replaceAll('-', '_')} = {loop: ${++loop}, hack: ${Math.floor(hackedMoney)}, money: ${Math.floor(currentMoney)} / ${Math.floor(maxMoney)} == ${((currentMoney / maxMoney) * 100).toFixed(2)}, security: ${currentSecurity.toFixed(2)} / ${Math.floor(minSecurity)} == ${((currentSecurity / minSecurity) * 100).toFixed(4)}};`);
|
await writeLog('LOG', `{server: '${server}', loop: ${++loop}, hack: ${Math.floor(hackedMoney)}, money: ${Math.floor(currentMoney)} / ${Math.floor(maxMoney)} == ${((currentMoney / maxMoney) * 100).toFixed(2)}, security: ${currentSecurity.toFixed(2)} / ${Math.floor(minSecurity)} == ${((currentSecurity / minSecurity) * 100).toFixed(4)}}`);
|
||||||
await ns.sleep(50);
|
await ns.sleep(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user