save backup
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/** @param {import(".").NS } ns */
|
/** @param {import(".").NS } ns */
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
|
|
||||||
async function writeLog(type, obj) {
|
async function writeLog(type, obj) {
|
||||||
let timestamp = '';
|
let timestamp = '';
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/** @param {import(".").NS } ns */
|
||||||
|
|
||||||
|
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, targetServer, previousServer = currentServer) {
|
||||||
|
ns.tprint(currentServer);
|
||||||
|
if (currentServer == targetServer) {
|
||||||
|
return [currentServer];
|
||||||
|
} else {
|
||||||
|
let availableServers = ns.scan(currentServer);
|
||||||
|
|
||||||
|
for (let i = 0; i < availableServers.length; ++i) {
|
||||||
|
let nextServer = availableServers[i];
|
||||||
|
|
||||||
|
if (nextServer != currentServer && nextServer != previousServer) {
|
||||||
|
let result = scanServer(nextServer, targetServer, currentServer);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
return [currentServer].concat(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let targetPath = scanServer('home', ns.args[0]);
|
||||||
|
ns.tprint(targetPath);
|
||||||
|
|
||||||
|
let backdoorCommand = '';
|
||||||
|
|
||||||
|
for (let index = 1; index < targetPath.length; index++) {
|
||||||
|
const server = targetPath[index];
|
||||||
|
|
||||||
|
backdoorCommand += `connect ${server}; `;
|
||||||
|
}
|
||||||
|
backdoorCommand += 'run BruteSSH.exe; ';
|
||||||
|
backdoorCommand += 'run FTPCrack.exe; ';
|
||||||
|
backdoorCommand += 'run relaySMTP.exe; ';
|
||||||
|
backdoorCommand += 'run HTTPWorm.exe; ';
|
||||||
|
backdoorCommand += 'run SQLInject.exe; ';
|
||||||
|
backdoorCommand += 'run NUKE.exe; ';
|
||||||
|
backdoorCommand += 'backdoor; home';
|
||||||
|
|
||||||
|
ns.tprint(backdoorCommand);
|
||||||
|
const terminalInput = document.getElementById("terminal-input");
|
||||||
|
terminalInput.value = backdoorCommand;
|
||||||
|
const handler = Object.keys(terminalInput)[1];
|
||||||
|
terminalInput[handler].onChange({ target: terminalInput });
|
||||||
|
terminalInput[handler].onKeyDown({ key: 'Enter', preventDefault: () => null });
|
||||||
|
}
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
/** @param {import(".").NS } ns */
|
/** @param {import(".").NS } ns */
|
||||||
|
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
|
|
||||||
let excludeServers = ['home'];
|
let excludeServers = ['home'];
|
||||||
for (let index = 0; index < 25; index++) {
|
for (let index = 0; index < 25; index++) {
|
||||||
@@ -32,11 +32,11 @@ export async function main(ns) {
|
|||||||
}
|
}
|
||||||
await ns.sleep(10);
|
await ns.sleep(10);
|
||||||
}
|
}
|
||||||
|
let runDepth = ns.args.length ? ns.args[0] : 1;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
let runDepth = ns.args.length ? ns.args[0] : 1;
|
ns.print(`Running scan depth: ${runDepth}`);
|
||||||
ns.tprint(`Running scan depth: ${runDepth}`);
|
|
||||||
await scanServer('home', runDepth);
|
await scanServer('home', runDepth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -9,6 +9,7 @@ export async function main(ns) {
|
|||||||
let levelCap = 150;
|
let levelCap = 150;
|
||||||
let ramCap = 64;
|
let ramCap = 64;
|
||||||
let coreCap = 4;
|
let coreCap = 4;
|
||||||
|
let nodeCap = 15;
|
||||||
ns.tprint(`Bot started {nodeCostThreshold: ${nodeCostThreshold}, upgradeCostThreshold: ${upgradeCostThreshold}, upgradeCount: ${upgradeCount}}`);
|
ns.tprint(`Bot started {nodeCostThreshold: ${nodeCostThreshold}, upgradeCostThreshold: ${upgradeCostThreshold}, upgradeCount: ${upgradeCount}}`);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -16,7 +17,7 @@ export async function main(ns) {
|
|||||||
let nodePurchaseCost = ns.hacknet.getPurchaseNodeCost();
|
let nodePurchaseCost = ns.hacknet.getPurchaseNodeCost();
|
||||||
let nodeCount = ns.hacknet.numNodes();
|
let nodeCount = ns.hacknet.numNodes();
|
||||||
|
|
||||||
if (nodePurchaseCost / Math.abs(currentMoney) < nodeCostThreshold) {
|
if (nodeCount < nodeCap && nodePurchaseCost / Math.abs(currentMoney) < nodeCostThreshold) {
|
||||||
ns.hacknet.purchaseNode();
|
ns.hacknet.purchaseNode();
|
||||||
currentMoney = ns.getServerMoneyAvailable("home");
|
currentMoney = ns.getServerMoneyAvailable("home");
|
||||||
++nodeCount;
|
++nodeCount;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -461,7 +461,7 @@
|
|||||||
export interface Server {
|
export interface Server {
|
||||||
/**
|
/**
|
||||||
* How many CPU cores this server has. Maximum of 8.
|
* How many CPU cores this server has. Maximum of 8.
|
||||||
* Affects magnitude of grow and weaken.
|
* Affects magnitude of grow and weaken.p
|
||||||
*/
|
*/
|
||||||
cpuCores: number;
|
cpuCores: number;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/** @param {import(".").NS } ns */
|
/** @param {import(".").NS } ns */
|
||||||
|
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
|
|
||||||
async function writeLog(obj) {
|
async function writeLog(obj) {
|
||||||
await ns.tryWritePort(1, obj + '\n');
|
await ns.tryWritePort(1, obj + '\n');
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/** @param {import(".").NS } ns */
|
/** @param {import(".").NS } ns */
|
||||||
|
|
||||||
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; server <= ns.args[0]; server++) {
|
||||||
|
ns.scp('grow-helper.js', `home-${server}`, 'home');
|
||||||
ns.exec('grow-helper.js', `home-${server}`, 5, 20);
|
ns.exec('grow-helper.js', `home-${server}`, 5, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user