-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathutils.js
43 lines (41 loc) · 942 Bytes
/
utils.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
/** @param {NS} ns **/
export function multiscan(ns, server) {
let serverList = [];
function scanning(server) {
let currentScan = ns.scan(server);
currentScan.forEach(server => {
if (!serverList.includes(server)) {
serverList.push(server);
scanning(server);
}
})
}
scanning(server);
return serverList;
}
export function gainRootAccess(ns, server) {
const serverData = ns.getServer(server);
if (ns.fileExists('brutessh.exe')) {
ns.brutessh(server);
}
if (ns.fileExists('ftpcrack.exe')) {
ns.ftpcrack(server);
}
if (ns.fileExists('relaysmtp.exe')) {
ns.relaysmtp(server);
}
if (ns.fileExists('httpworm.exe')) {
ns.httpworm(server);
}
if (ns.fileExists('sqlinject.exe')) {
ns.sqlinject(server);
}
if (ns.getServerNumPortsRequired(server) <= serverData.openPortCount) {
ns.nuke(server);
}
/* Requires Singularity 4-1
if (!serverData.backdoorInstalled) {
ns.installBackdoor(server);
}
*/
}