Updated target wording to device
This commit is contained in:
parent
e45bd99be6
commit
d04d9d3b99
18
README.md
18
README.md
@ -66,18 +66,18 @@ Options:
|
|||||||
### [miner.js](./scripts/miner.js)
|
### [miner.js](./scripts/miner.js)
|
||||||
**RAM:** 2.45 GB
|
**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
|
[home ~/]> run scripts/miner.js --help
|
||||||
Running script with 1 thread(s), pid 1 and args: ["--help"].
|
Running script with 1 thread(s), pid 1 and args: ["--help"].
|
||||||
/scripts/miner.js:
|
/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
|
run miner.js --help
|
||||||
|
|
||||||
TARGET Device to mine, defaults to current machine
|
DEVICE Device to mine, defaults to current machine
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h --help Display this help message
|
-h --help Display this help message
|
||||||
@ -100,10 +100,10 @@ Scan the network for devices and display as an ASCII tree:
|
|||||||
├─ foodnstuff (ROOTED)
|
├─ foodnstuff (ROOTED)
|
||||||
└─ sigma-cosmetics (ROOTED)
|
└─ sigma-cosmetics (ROOTED)
|
||||||
|
|
||||||
Usage: run network-graph.js [OPTIONS] [TARGET]
|
Usage: run network-graph.js [OPTIONS] [DEVICE]
|
||||||
run network-graph.js --help
|
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:
|
Options:
|
||||||
-d --depth Depth to scan to, defaults to 3
|
-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"].
|
Running script with 1 thread(s), pid 1 and args: ["--help"].
|
||||||
/scripts/rootkit.js:
|
/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
|
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
|
SCRIPT Script to copy & execute
|
||||||
ARGS Arguments for script. Forward the current target with: {{TARGET}}
|
ARGS Arguments for script. Forward the current target with: {{TARGET}}
|
||||||
|
|
||||||
|
@ -10,16 +10,16 @@ export async function main(ns) {
|
|||||||
const historyLength = 15;
|
const historyLength = 15;
|
||||||
const messageHistory = Array(historyLength).fill('');
|
const messageHistory = Array(historyLength).fill('');
|
||||||
let maxBalance, balance, minSecurity, security;
|
let maxBalance, balance, minSecurity, security;
|
||||||
const argParser = new ArgParser('miner.js', 'Weaken, Grow, Hack loop to "mine" target machine for money.', null, [
|
const argParser = new ArgParser('miner.js', 'Weaken, Grow, Hack loop to "mine" machine for money.', null, [
|
||||||
{name: 'target', desc: 'Device to mine, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'}
|
{name: 'device', desc: 'Device to mine, defaults to current machine', optional: true, default: ns.getHostname(), type: 'string'}
|
||||||
]);
|
]);
|
||||||
let args;
|
let args;
|
||||||
try {
|
try {
|
||||||
args = argParser.parse(ns.args);
|
args = argParser.parse(ns.args);
|
||||||
maxBalance = await ns.getServerMaxMoney(args['target']);
|
maxBalance = await ns.getServerMaxMoney(args['device']);
|
||||||
balance = await ns.getServerMoneyAvailable(args['target']);
|
balance = await ns.getServerMoneyAvailable(args['device']);
|
||||||
minSecurity = await ns.getServerMinSecurityLevel(args['target']) + 2;
|
minSecurity = await ns.getServerMinSecurityLevel(args['device']) + 2;
|
||||||
security = await ns.getServerSecurityLevel(args['target']);
|
security = await ns.getServerSecurityLevel(args['device']);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
if(err instanceof ArgError) return ns.tprint(argParser.help(err.message));
|
if(err instanceof ArgError) return ns.tprint(argParser.help(err.message));
|
||||||
throw err;
|
throw err;
|
||||||
@ -33,7 +33,7 @@ export async function main(ns) {
|
|||||||
const sec = `${Math.round(security)}/${minSecurity}`;
|
const sec = `${Math.round(security)}/${minSecurity}`;
|
||||||
ns.clearLog();
|
ns.clearLog();
|
||||||
ns.print('===================================================');
|
ns.print('===================================================');
|
||||||
ns.print(`Mining: ${args['target']}`);
|
ns.print(`Mining: ${args['device']}`);
|
||||||
ns.print('===================================================');
|
ns.print('===================================================');
|
||||||
ns.print(`Security: ${sec}${sec.length < 6 ? '\t' : ''}\tBalance: $${Math.round(balance * 100) / 100}`);
|
ns.print(`Security: ${sec}${sec.length < 6 ? '\t' : ''}\tBalance: $${Math.round(balance * 100) / 100}`);
|
||||||
ns.print('===================================================');
|
ns.print('===================================================');
|
||||||
@ -45,21 +45,21 @@ export async function main(ns) {
|
|||||||
log();
|
log();
|
||||||
do {
|
do {
|
||||||
// Update information
|
// Update information
|
||||||
security = await ns.getServerSecurityLevel(args['target']);
|
security = await ns.getServerSecurityLevel(args['device']);
|
||||||
balance = await ns.getServerMoneyAvailable(args['target']);
|
balance = await ns.getServerMoneyAvailable(args['device']);
|
||||||
|
|
||||||
// Pick step
|
// Pick step
|
||||||
if(security > minSecurity) { // Weaken
|
if(security > minSecurity) { // Weaken
|
||||||
log('Attacking Security...');
|
log('Attacking Security...');
|
||||||
const w = await ns.weaken(args['target']);
|
const w = await ns.weaken(args['device']);
|
||||||
log(`Security: -${w}`);
|
log(`Security: -${w}`);
|
||||||
} else if(balance < maxBalance) { // Grow
|
} else if(balance < maxBalance) { // Grow
|
||||||
log('Spoofing Balance...');
|
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}`);
|
log(`Balance: +$${Math.round((g * balance - balance) * 100) / 100}`);
|
||||||
} else { // Hack
|
} else { // Hack
|
||||||
log('Hacking Account...');
|
log('Hacking Account...');
|
||||||
const h = await ns.hack(args['target']);
|
const h = await ns.hack(args['device']);
|
||||||
log(`Balance: -$${h}`);
|
log(`Balance: -$${h}`);
|
||||||
}
|
}
|
||||||
} while(true);
|
} while(true);
|
||||||
|
@ -4,7 +4,7 @@ export async function main(ns) {
|
|||||||
// Setup
|
// Setup
|
||||||
ns.disableLog('ALL');
|
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, [
|
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: '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: 'filter', desc: 'Display devices matching name', flags: ['-f', '--filter'], type: 'string'},
|
||||||
{name: 'regex', desc: 'Display devices matching pattern', flags: ['-r', '--regex'], type: 'string'},
|
{name: 'regex', desc: 'Display devices matching pattern', flags: ['-r', '--regex'], type: 'string'},
|
||||||
@ -85,8 +85,8 @@ export async function main(ns) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run
|
// Run
|
||||||
ns.tprint(args['target']);
|
ns.tprint(args['device']);
|
||||||
const found = scan(args['target']);
|
const found = scan(args['device']);
|
||||||
if(args['regex']) filter(found, args['regex'], true);
|
if(args['regex']) filter(found, args['regex'], true);
|
||||||
else if(args['filter']) filter(found, args['filter']);
|
else if(args['filter']) filter(found, args['filter']);
|
||||||
render(found);
|
render(found);
|
||||||
|
@ -8,8 +8,8 @@ import {downloadPrint, slowPrint} from './scripts/lib/utils';
|
|||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// Setup
|
// Setup
|
||||||
ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
const argParser = new ArgParser('rootkit.js', 'Automatically gain root on a target machine. A file can also be uploaded & executed.', null, [
|
const argParser = new ArgParser('rootkit.js', 'Automatically gain root access to a device. 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'},
|
{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: '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: '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'},
|
{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;
|
let args;
|
||||||
try {
|
try {
|
||||||
args = argParser.parse(ns.args);
|
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) {
|
} catch(err) {
|
||||||
if(err instanceof ArgError) return ns.tprint(argParser.help(err.message));
|
if(err instanceof ArgError) return ns.tprint(argParser.help(err.message));
|
||||||
throw err;
|
throw err;
|
||||||
@ -45,23 +45,23 @@ export async function main(ns) {
|
|||||||
|
|
||||||
// Banner
|
// Banner
|
||||||
ns.tprint('===================================================');
|
ns.tprint('===================================================');
|
||||||
ns.tprint(`Rooting: ${args['target']}`);
|
ns.tprint(`Rooting: ${args['device']}`);
|
||||||
await slowPrint(ns, '===================================================');
|
await slowPrint(ns, '===================================================');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Run exploits
|
// Run exploits
|
||||||
await slowPrint(ns, `Attacking over SSH (${args['target']}:22)...`, 1, 2);
|
await slowPrint(ns, `Attacking over SSH (${args['device']}:22)...`, 1, 2);
|
||||||
ns.brutessh(args['target']);
|
ns.brutessh(args['device']);
|
||||||
await slowPrint(ns, `Attacking over FTP (${args['target']}:24)...`, 1, 2);
|
await slowPrint(ns, `Attacking over FTP (${args['device']}:24)...`, 1, 2);
|
||||||
ns.ftpcrack(args['target']);
|
ns.ftpcrack(args['device']);
|
||||||
await slowPrint(ns, `Attacking over SMTP (${args['target']}:25)...`, 1, 2);
|
await slowPrint(ns, `Attacking over SMTP (${args['device']}:25)...`, 1, 2);
|
||||||
ns.relaysmtp(args['target']);
|
ns.relaysmtp(args['device']);
|
||||||
} catch {
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
// Attempt root
|
// Attempt root
|
||||||
ns.tprint('');
|
ns.tprint('');
|
||||||
ns.nuke(args['target'])
|
ns.nuke(args['device'])
|
||||||
ns.tprint(`Root: Success!`);
|
ns.tprint(`Root: Success!`);
|
||||||
ns.tprint('');
|
ns.tprint('');
|
||||||
} catch {
|
} catch {
|
||||||
@ -77,16 +77,16 @@ export async function main(ns) {
|
|||||||
await slowPrint(ns, 'Copying files:');
|
await slowPrint(ns, 'Copying files:');
|
||||||
const deps = [...(await dependencyFinder(args['script'])), args['script']];
|
const deps = [...(await dependencyFinder(args['script'])), args['script']];
|
||||||
for(let dep of deps) {
|
for(let dep of deps) {
|
||||||
await ns.scp(dep, args['target']);
|
await ns.scp(dep, args['device']);
|
||||||
await downloadPrint(ns, dep);
|
await downloadPrint(ns, dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run script
|
// Run script
|
||||||
ns.tprint('');
|
ns.tprint('');
|
||||||
await slowPrint(ns, `Executing with ${args['cpu']} thread${args['cpu'] > 1 ? 's' : ''}...`);
|
await slowPrint(ns, `Executing with ${args['cpu']} thread${args['cpu'] > 1 ? 's' : ''}...`);
|
||||||
ns.scriptKill(args['script'], args['target']);
|
ns.scriptKill(args['script'], args['device']);
|
||||||
const pid = ns.exec(args['script'], args['target'], args['cpu'], ...args['args']
|
const pid = ns.exec(args['script'], args['device'], args['cpu'], ...args['args']
|
||||||
.map(a => a == '{{TARGET}}' ? args['target'] : a));
|
.map(a => a == '{{TARGET}}' ? args['device'] : a));
|
||||||
ns.tprint(!!pid ? 'Done!' : 'Failed to start');
|
ns.tprint(!!pid ? 'Done!' : 'Failed to start');
|
||||||
ns.tprint('');
|
ns.tprint('');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user