Compare commits
2 Commits
74aae19a82
...
677f23ea8d
Author | SHA1 | Date | |
---|---|---|---|
677f23ea8d | |||
29d88170ab |
15
servers/home/programs.ts
Normal file
15
servers/home/programs.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { recursiveScan } from "./utils"
|
||||||
|
|
||||||
|
export async function main(ns: NS){
|
||||||
|
switch (ns.args[0]) {
|
||||||
|
case "getServers":
|
||||||
|
getServers(ns);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ns.tprint("Invalid program name");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getServers(ns: NS) {
|
||||||
|
ns.tprint(recursiveScan(ns));
|
||||||
|
}
|
@ -97,11 +97,11 @@ export function performFunctionIfCapable(ns: NS, server: string, func: CallableF
|
|||||||
}
|
}
|
||||||
if (ns.getServerNumPortsRequired(server) < ns.getServer(server).openPortCount) {
|
if (ns.getServerNumPortsRequired(server) < ns.getServer(server).openPortCount) {
|
||||||
ns.print(`Not enough ports, trying to root ${server}`)
|
ns.print(`Not enough ports, trying to root ${server}`)
|
||||||
|
}
|
||||||
if (rootServer(ns, server) < ns.getServerNumPortsRequired(server)) {
|
if (rootServer(ns, server) < ns.getServerNumPortsRequired(server)) {
|
||||||
ns.print(`Need more port opening programs to root ${server}`)
|
ns.print(`Need more port opening programs to root ${server}`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!ns.hasRootAccess(server)) {
|
if (!ns.hasRootAccess(server)) {
|
||||||
ns.print(`Failed to root ${server}`)
|
ns.print(`Failed to root ${server}`)
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user