-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworm.js
67 lines (60 loc) · 3.36 KB
/
worm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Custom little thing for Bitburner's script editor to use some intellicomplete thing, idk, RTFM.
/**
* @param {NS} ns
**/
// Array of who to iterate through and smack around. I was going to automate the gathering but the scan() function doesn't have a depth param, so this is easier for now. Don't feel like writing a wholeass worm yet.
const patheticVictims = ["n00dles", "foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym", "max-hardware", "zer0", "nectar-net", "CSEC", "neo-net", "silver-helix", "omega-net", "phantasy", "avmnite-02h","the-hub", "comptek", "netlink", "johnson-ortho", "crush-fitness", "rothman-uni", "catalyst", "zb-institute", "I.I.I.I", "summit-uni", "lexo-corp", "rho-construction", "millenium-fitness", "syscore", "aevum-police", "aerocorp", "alpha-ent", "galactic-cyber", "omnia", "icarus", "zb-def", "global-pharm", "unitalife", "defcomm", "snap-fitness", "deltaone", "univ-energy", "taiyang-digital", "nova-med", "solaris", "infocomm", "zeus-med"];
const availableExploits = ["brutessh.exe", "ftpcrack.exe", "relaysmtp.exe", "httpworm.exe", "sqlinject.exe"]
// Begin hooking into the game.
export async function main(ns) {
let hackingLevel = await ns.getHackingLevel(); // We must determine how much of a l33t 4ax0r we are. Are we a sk1d or a m4st3r Mossad h4ck3r?
let currentExploits = 0 // Counter for number of exploits currently in home directory.
// Iterate through the available exploits within the game and check the home directory for their presence. This little fucker stumped me for like... 6 hours.
for (let exploits of availableExploits) {
if (await ns.fileExists(exploits, "home") == true) {
currentExploits++
};
};
ns.print("Beginning ping sweep..."); // Is it really a ping sweep if your targets are pre-defined? It sounds good, so who cares.
// I'm sure there's a more efficient way to do this but for now, this'll just burn through the pathetic weaklings, see if they're vulnerable and then execute the necessary functions to turbo yeet them.
for (let victim of patheticVictims) {
if (await ns.getServerRequiredHackingLevel(victim) <= hackingLevel && await ns.getServerNumPortsRequired(victim) <= currentExploits && await ns.hasRootAccess(victim) == false) {
if (currentExploits == 0) {
await ns.nuke(victim);
// I
} else if (currentExploits == 1) {
await ns.brutessh(victim);
await ns.nuke(victim);
// Know
} else if (currentExploits == 2) {
await ns.brutessh(victim);
await ns.ftpcrack(victim);
await ns.nuke(victim);
// I'm
} else if (currentExploits == 3) {
await ns.brutessh(victim);
await ns.ftpcrack(victim);
await ns.relaysmtp(victim);
await ns.nuke(victim);
// A
} else if (currentExploits == 4) {
await ns.brutessh(victim);
await ns.ftpcrack(victim);
await ns.relaysmtp(victim);
await ns.httpworm(victim);
await ns.nuke(victim)
// Loser
} else if (currentExploits == 5) {
await ns.brutessh(victim);
await ns.ftpcrack(victim);
await ns.relaysmtp(victim);
await ns.httpworm(victim);
await ns.sqlinject(victim)
await ns.nuke(victim)
};
ns.print("Cracked and hacked!")
} else {
ns.print("Not hackable yet or already pwned.")
};
};
};