-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakePrograms.js
47 lines (44 loc) · 1.28 KB
/
makePrograms.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
/** @param {NS} ns **/
export async function main(ns) {
ns.tail();
ns.disableLog('sleep');
ns.clearLog();
//Initial list of all available programs
const programList = ['BruteSSH.exe', 'ServerProfiler.exe', 'AutoLink.exe', 'FTPCrack.exe', 'relaySMTP.exe', 'HTTPWorm.exe', 'SQLInject.exe', 'DeepscanV1.exe', 'DeepscanV2.exe', 'Formulas.exe']
//Create all of the programs
for (let prog of programList) {
if (ns.fileExists(prog)) {
ns.print('You already have ' + prog);
await ns.sleep(100);
continue;
} else {
ns.createProgram(prog, focus = false);
while (ns.isBusy()) {
await ns.sleep(100);
}
ns.print('Finished creating ' + prog);
}
//secondary list of programs to repeat creation for Int farming
const secondList = ['ServerProfiler.exe', 'AutoLink.exe', 'DeepscanV1.exe', 'DeepscanV2.exe']
while (true) {
//need to remove programs first, to be able to recreate them
for (let sec of secondList) {
if (ns.fileExists(sec)) {
ns.rm(sec);
ns.print('Removed ' + sec);
await ns.sleep(100);
} else {
await ns.sleep(100);
}
}
//now to recreate
for (let sec of secondList) {
ns.createProgram(sec, focus = false);
while (ns.isBusy()) {
await ns.sleep(100);
}
ns.print('Finished creating ' + sec);
}
}
}
}