Create or edit scripts > nano | nano "hostname".js. note that CNTRL-C will end a command (like hack) early
Hacknet - buy nodes to add to hacknet system, earn percentage return on all hacks using system (passive income). These are upgradeable.
City - shows all connections that can be traveled to from current location (ie, home)
Hacker Groups - The Black Hand | NiteSec | BitRunners
Criminal Organizations - The Syndicate | Slum Snakes
export async function main(ns) {
while(true) {
await ns.hack('n00dles');
}
}
export async function main(ns) {
// Defines the "target server", which is the server
// that we're going to hack. In this case, it's "n00dles"
const target = "n00dles";
// Defines how much money a server should have before we hack it
// In this case, it is set to 75% of the server's max money
const moneyThresh = ns.getServerMaxMoney(target) * 0.75;
// Defines the maximum security level the target server can
// have. If the target's security level is higher than this,
// we'll weaken it before doing anything else
const securityThresh = ns.getServerMinSecurityLevel(target) + 5;
// If we have the BruteSSH.exe program, use it to open the SSH Port
// on the target server
if (ns.fileExists("BruteSSH.exe", "home")) {
ns.brutessh(target);
}
// Get root access to target server
ns.nuke(target);
// Infinite loop that continously hacks/grows/weakens the target server
while(true) {
if (ns.getServerSecurityLevel(target) > securityThresh) {
// If the server's security level is above our threshold, weaken it
await ns.weaken(target);
} else if (ns.getServerMoneyAvailable(target) < moneyThresh) {
// If the server's money is less than our threshold, grow it
await ns.grow(target);
} else {
// Otherwise, hack it
await ns.hack(target);
}
}
}
invoke using RUN command (requires available RAM).
check details on each .js script with command "tail hostname.js"
read comments for code explanation
Keyboard Shortcuts
- Alt-S - Active Scripts
Commands
- help
- ls [list directory]
- scan [show closest connections]
- scan-analyze [param node amount: default 1]
- connect hostname
- analyze [server info]
- run NUKE.exe
- hack
- weaken [-security]
- grow [+money +security +hackspeed]
- home
- nano [name.js start new script]
- free [check avail RAM]
- kill name.js [from Terminal]