diff --git a/README.md b/README.md index 9711155..745f53c 100644 --- a/README.md +++ b/README.md @@ -66,18 +66,18 @@ Options: ### [miner.js](./scripts/miner.js) **RAM:** 2.45 GB -Weaken, Grow, Hack loop to "mine" target machine for money. +Weaken, Grow, Hack loop to "mine" machine for money. ``` [home ~/]> run scripts/miner.js --help Running script with 1 thread(s), pid 1 and args: ["--help"]. /scripts/miner.js: -Weaken, Grow, Hack loop to "mine" target machine for money. +Weaken, Grow, Hack loop to "mine" machine for money. -Usage: run miner.js [TARGET] +Usage: run miner.js [DEVICE] run miner.js --help - TARGET Device to mine, defaults to current machine + DEVICE Device to mine, defaults to current machine Options: -h --help Display this help message @@ -100,10 +100,10 @@ Scan the network for devices and display as an ASCII tree: ├─ foodnstuff (ROOTED) └─ sigma-cosmetics (ROOTED) -Usage: run network-graph.js [OPTIONS] [TARGET] +Usage: run network-graph.js [OPTIONS] [DEVICE] run network-graph.js --help - TARGET Point to start scan from, defaults to current machine + DEVICE Point to start scan from, defaults to current machine Options: -d --depth Depth to scan to, defaults to 3 @@ -145,12 +145,12 @@ Programs can be commented out to lower the cost of running. Running script with 1 thread(s), pid 1 and args: ["--help"]. /scripts/rootkit.js: -Automatically gain root on a target machine. A file can also be uploaded & executed. +Automatically gain root access to a device. A file can also be uploaded & executed. -Usage: run rootkit.js [OPTIONS] [TARGET] [SCRIPT] [ARGS]... +Usage: run rootkit.js [OPTIONS] [DEVICE] [SCRIPT] [ARGS]... run rootkit.js --help - TARGET Target machine to root, defaults to current machine + DEVICE Device to root, defaults to current machine SCRIPT Script to copy & execute ARGS Arguments for script. Forward the current target with: {{TARGET}} diff --git a/scripts/miner.js b/scripts/miner.js index 4eb8efd..cc4f850 100644 --- a/scripts/miner.js +++ b/scripts/miner.js @@ -10,16 +10,16 @@ export async function main(ns) { const historyLength = 15; const messageHistory = Array(historyLength).fill(''); let maxBalance, balance, minSecurity, security; - const argParser = new ArgParser('miner.js', 'Weaken, Grow, Hack loop to "mine" target machine for money.', null, [ - {name: 'target', desc: 'Device to mine, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'} + const argParser = new ArgParser('miner.js', 'Weaken, Grow, Hack loop to "mine" machine for money.', null, [ + {name: 'device', desc: 'Device to mine, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'} ]); let args; try { args = argParser.parse(ns.args); - maxBalance = await ns.getServerMaxMoney(args['target']); - balance = await ns.getServerMoneyAvailable(args['target']); - minSecurity = await ns.getServerMinSecurityLevel(args['target']) + 2; - security = await ns.getServerSecurityLevel(args['target']); + maxBalance = await ns.getServerMaxMoney(args['device']); + balance = await ns.getServerMoneyAvailable(args['device']); + minSecurity = await ns.getServerMinSecurityLevel(args['device']) + 2; + security = await ns.getServerSecurityLevel(args['device']); } catch(err) { if(err instanceof ArgError) return ns.tprint(argParser.help(err.message)); throw err; @@ -33,7 +33,7 @@ export async function main(ns) { const sec = `${Math.round(security)}/${minSecurity}`; ns.clearLog(); ns.print('==================================================='); - ns.print(`Mining: ${args['target']}`); + ns.print(`Mining: ${args['device']}`); ns.print('==================================================='); ns.print(`Security: ${sec}${sec.length < 6 ? '\t' : ''}\tBalance: $${Math.round(balance * 100) / 100}`); ns.print('==================================================='); @@ -45,21 +45,21 @@ export async function main(ns) { log(); do { // Update information - security = await ns.getServerSecurityLevel(args['target']); - balance = await ns.getServerMoneyAvailable(args['target']); + security = await ns.getServerSecurityLevel(args['device']); + balance = await ns.getServerMoneyAvailable(args['device']); // Pick step if(security > minSecurity) { // Weaken log('Attacking Security...'); - const w = await ns.weaken(args['target']); + const w = await ns.weaken(args['device']); log(`Security: -${w}`); } else if(balance < maxBalance) { // Grow log('Spoofing Balance...'); - const g = await ns.grow(args['target']); + const g = await ns.grow(args['device']); log(`Balance: +$${Math.round((g * balance - balance) * 100) / 100}`); } else { // Hack log('Hacking Account...'); - const h = await ns.hack(args['target']); + const h = await ns.hack(args['device']); log(`Balance: -$${h}`); } } while(true); diff --git a/scripts/network-graph.js b/scripts/network-graph.js index ac6a2f7..de5b281 100644 --- a/scripts/network-graph.js +++ b/scripts/network-graph.js @@ -4,7 +4,7 @@ export async function main(ns) { // Setup ns.disableLog('ALL'); const argParser = new ArgParser('network-graph.js', 'Scan the network for devices and display as an ASCII tree:\n home\n ├─ n00dles (ROOTED)\n | └─ max-hardware (80|1)\n | └─ neo-net (50|1)\n ├─ foodnstuff (ROOTED)\n └─ sigma-cosmetics (ROOTED)', null, [ - {name: 'target', desc: 'Point to start scan from, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'}, + {name: 'device', desc: 'Point to start scan from, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'}, {name: 'depth', desc: 'Depth to scan to, defaults to 3', flags: ['-d', '--depth'], default: Infinity, type: 'num'}, {name: 'filter', desc: 'Display devices matching name', flags: ['-f', '--filter'], type: 'string'}, {name: 'regex', desc: 'Display devices matching pattern', flags: ['-r', '--regex'], type: 'string'}, @@ -85,8 +85,8 @@ export async function main(ns) { } // Run - ns.tprint(args['target']); - const found = scan(args['target']); + ns.tprint(args['device']); + const found = scan(args['device']); if(args['regex']) filter(found, args['regex'], true); else if(args['filter']) filter(found, args['filter']); render(found); diff --git a/scripts/rootkit.js b/scripts/rootkit.js index 70e1dc1..d389698 100644 --- a/scripts/rootkit.js +++ b/scripts/rootkit.js @@ -8,8 +8,8 @@ import {downloadPrint, slowPrint} from './scripts/lib/utils'; export async function main(ns) { // Setup ns.disableLog('ALL'); - const argParser = new ArgParser('rootkit.js', 'Automatically gain root on a target machine. A file can also be uploaded & executed.', null, [ - {name: 'target', desc: 'Target machine to root, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'}, + const argParser = new ArgParser('rootkit.js', 'Automatically gain root access to a device. A file can also be uploaded & executed.', null, [ + {name: 'device', desc: 'Device to root, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'}, {name: 'script', desc: 'Script to copy & execute', optional: true, type: 'string'}, {name: 'args', desc: 'Arguments for script. Forward the current target with: {{TARGET}}', optional: true, extras: true, type: 'string'}, {name: 'cpu', desc: 'Number of CPU threads to use with script', flags: ['-c', '--cpu'], type: 'num'}, @@ -17,7 +17,7 @@ export async function main(ns) { let args; try { args = argParser.parse(ns.args); - if(args['script'] && !args['cpu']) args['cpu'] = ~~(ns.getServerMaxRam(args['target']) / ns.getScriptRam(args['script'], 'home')) || 1; + if(args['script'] && !args['cpu']) args['cpu'] = ~~(ns.getServerMaxRam(args['device']) / ns.getScriptRam(args['script'], 'home')) || 1; } catch(err) { if(err instanceof ArgError) return ns.tprint(argParser.help(err.message)); throw err; @@ -45,23 +45,23 @@ export async function main(ns) { // Banner ns.tprint('==================================================='); - ns.tprint(`Rooting: ${args['target']}`); + ns.tprint(`Rooting: ${args['device']}`); await slowPrint(ns, '==================================================='); try { // Run exploits - await slowPrint(ns, `Attacking over SSH (${args['target']}:22)...`, 1, 2); - ns.brutessh(args['target']); - await slowPrint(ns, `Attacking over FTP (${args['target']}:24)...`, 1, 2); - ns.ftpcrack(args['target']); - await slowPrint(ns, `Attacking over SMTP (${args['target']}:25)...`, 1, 2); - ns.relaysmtp(args['target']); + await slowPrint(ns, `Attacking over SSH (${args['device']}:22)...`, 1, 2); + ns.brutessh(args['device']); + await slowPrint(ns, `Attacking over FTP (${args['device']}:24)...`, 1, 2); + ns.ftpcrack(args['device']); + await slowPrint(ns, `Attacking over SMTP (${args['device']}:25)...`, 1, 2); + ns.relaysmtp(args['device']); } catch { } finally { try { // Attempt root ns.tprint(''); - ns.nuke(args['target']) + ns.nuke(args['device']) ns.tprint(`Root: Success!`); ns.tprint(''); } catch { @@ -77,16 +77,16 @@ export async function main(ns) { await slowPrint(ns, 'Copying files:'); const deps = [...(await dependencyFinder(args['script'])), args['script']]; for(let dep of deps) { - await ns.scp(dep, args['target']); + await ns.scp(dep, args['device']); await downloadPrint(ns, dep); } // Run script ns.tprint(''); await slowPrint(ns, `Executing with ${args['cpu']} thread${args['cpu'] > 1 ? 's' : ''}...`); - ns.scriptKill(args['script'], args['target']); - const pid = ns.exec(args['script'], args['target'], args['cpu'], ...args['args'] - .map(a => a == '{{TARGET}}' ? args['target'] : a)); + ns.scriptKill(args['script'], args['device']); + const pid = ns.exec(args['script'], args['device'], args['cpu'], ...args['args'] + .map(a => a == '{{TARGET}}' ? args['device'] : a)); ns.tprint(!!pid ? 'Done!' : 'Failed to start'); ns.tprint(''); }