@grey-ts/types 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1078 -719
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,234 @@
|
|
|
1
|
+
declare namespace GreyHack {
|
|
2
|
+
interface AptClient {
|
|
3
|
+
classID: "aptClientLib";
|
|
4
|
+
/**
|
|
5
|
+
* Inserts a repository address into the `/etc/apt/sources.txt` file.
|
|
6
|
+
*
|
|
7
|
+
* On success, it will return an empty string. In case of failure, it will return a string with an error message.
|
|
8
|
+
* @example
|
|
9
|
+
* const aptClient = includeLib("/lib/aptclient.so");
|
|
10
|
+
* if (!isType(aptClient, "aptClientLib")) exit("Failed to find aptclient.");
|
|
11
|
+
*
|
|
12
|
+
* const failString = aptClient.addRepo("42.141.12.6");
|
|
13
|
+
* if (failString)
|
|
14
|
+
* console.log("Failed to add repo: " + failString);
|
|
15
|
+
* else
|
|
16
|
+
* console.log("Added repo successfully!");
|
|
17
|
+
*/
|
|
18
|
+
addRepo(repositoryAddress: string, port?: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if there is a newer version of the program or library in the repository.
|
|
21
|
+
*
|
|
22
|
+
* On success, it will return a boolean, with false indicating that there is no new version, while true indicates that there is a new version available.
|
|
23
|
+
*
|
|
24
|
+
* In case of failure, it will return a string containing an error message.
|
|
25
|
+
*/
|
|
26
|
+
checkUpgrade(filePath: string): boolean | string;
|
|
27
|
+
/**
|
|
28
|
+
* Deletes a repository address from the `/etc/apt/sources.txt` file.
|
|
29
|
+
*
|
|
30
|
+
* On success, it will return an empty string. In case of failure, it will return a string with an error message.
|
|
31
|
+
*/
|
|
32
|
+
delRepo(repositoryAddress: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Installs a program or library from a remote repository listed in `/etc/apt/sources.txt`.
|
|
35
|
+
*
|
|
36
|
+
* If no path is specified, the program installs in `/lib` if it is a library or in `/bin` otherwise.
|
|
37
|
+
*
|
|
38
|
+
* On success, this method will return true. In case of failure, it will return a string containing an error message.
|
|
39
|
+
*/
|
|
40
|
+
install(package: string, installPath?: string): true | string;
|
|
41
|
+
/**
|
|
42
|
+
* Search specifically looks for a package in any of the repositories listed in `/etc/apt/sources.txt`.
|
|
43
|
+
*
|
|
44
|
+
* On success, it will return a string containing all packages that partially match the provided search value.
|
|
45
|
+
*
|
|
46
|
+
* On failure, it will return a string with various error messages.
|
|
47
|
+
*/
|
|
48
|
+
search(package: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Show displays all the packages available in a repository. The repository must be listed in the `/etc/apt/sources.txt` file.
|
|
51
|
+
*
|
|
52
|
+
* If it cannot find a repository, it will return various error messages.
|
|
53
|
+
*
|
|
54
|
+
* On success, it will return a string containing all packages and their descriptions, with each entry separated by a newline.
|
|
55
|
+
*/
|
|
56
|
+
show(repositoryAddress: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Update refreshes the list of available packages after adding a new repository in `/etc/apt/sources.txt`, or if the remote repository has updated its information in `/server/conf/repod.conf`.
|
|
59
|
+
*
|
|
60
|
+
* If the update is successful, an empty string will be returned. In case of failure, a string with an error message will be returned.
|
|
61
|
+
*
|
|
62
|
+
* If for some reason the `/etc/apt/sources.txt` is malformed this method will return false.
|
|
63
|
+
*/
|
|
64
|
+
update(): string | false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
interface Array<T> {
|
|
68
|
+
readonly length: number;
|
|
69
|
+
/** Returns a boolean indicating if the provided index exists in the array */
|
|
70
|
+
hasIndex(index: number): boolean;
|
|
71
|
+
/** Returns the index of the first occurrence of a value in an array, or null if it is not present. */
|
|
72
|
+
indexOf(value: T, offset?: number): number | null;
|
|
73
|
+
/** Returns an array containing the indexes of the array */
|
|
74
|
+
indexes(): number[];
|
|
75
|
+
/** Inserts a value into the array at the provided index. This method mutates the array and returns a reference to the same array. */
|
|
76
|
+
insert(index: number, value: T): T[];
|
|
77
|
+
/**
|
|
78
|
+
* Returns a concatenated string containing all stringified values inside the list. These values will be separated via the provided separator.
|
|
79
|
+
*
|
|
80
|
+
* In case the list exceeds `16777215L` items or the delimiter exceeds 128 characters, this method will throw an error, interrupting further script execution.
|
|
81
|
+
*/
|
|
82
|
+
join(delimiter: string): string;
|
|
83
|
+
/** Removes the first element from an array and returns it. If the array is empty, null is returned. */
|
|
84
|
+
shift(): T | null;
|
|
85
|
+
/** Inserts new elements at the start of an array, and returns the new length of the array. */
|
|
86
|
+
unshift(...items: T[]): number;
|
|
87
|
+
/** Removes the last element from an array and returns it. If the array is empty, null is returned. */
|
|
88
|
+
pop(): T | null;
|
|
89
|
+
/** Appends new elements to the end of an array, and returns the new length of the array. */
|
|
90
|
+
push(...items: T[]): number;
|
|
91
|
+
/**
|
|
92
|
+
* Removes an item from the list with the provided index. Due to the removal the list will get mutated.
|
|
93
|
+
*/
|
|
94
|
+
remove(index: number): null;
|
|
95
|
+
/**
|
|
96
|
+
* Changes every value of the array that matches `oldValue` into `newValue`
|
|
97
|
+
*
|
|
98
|
+
* This method mutates the array and returns a reference to the same array.
|
|
99
|
+
*/
|
|
100
|
+
replace(oldValue: T, newValue: T, maxCount?: number): T[];
|
|
101
|
+
/** Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array. */
|
|
102
|
+
reverse(): T;
|
|
103
|
+
/** Shuffles all values in the array. This method mutates the array. */
|
|
104
|
+
shuffle(): null;
|
|
105
|
+
/**
|
|
106
|
+
* Sorts the values of an array alphanumerically.
|
|
107
|
+
*
|
|
108
|
+
* This operation mutates the original array. Optionally, a key can be provided, which is used if the items are objects or arrays. Finally, this method returns the updated array.
|
|
109
|
+
* @example
|
|
110
|
+
* const myArray = [{ key: 123 }, { key: 5 }, { key: 17 }];
|
|
111
|
+
* myArray.sort("key");
|
|
112
|
+
*
|
|
113
|
+
* const numbers = [1,2,3,4,5];
|
|
114
|
+
* numbers.sort()
|
|
115
|
+
*/
|
|
116
|
+
sort(key?: PropertyKey | null, ascending?: boolean): T[];
|
|
117
|
+
/** Returns a sum of all values inside the array. Any non-numeric values will be considered a zero. */
|
|
118
|
+
sum(): number;
|
|
119
|
+
values(): T[];
|
|
120
|
+
/**
|
|
121
|
+
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
|
|
122
|
+
* @param value value to fill array section with
|
|
123
|
+
* @param start index to start filling the array at. If start is negative, it is treated as
|
|
124
|
+
* length+start where length is the length of the array.
|
|
125
|
+
* @param end index to stop filling the array at. If end is negative, it is treated as
|
|
126
|
+
* length+end.
|
|
127
|
+
*/
|
|
128
|
+
fill(value: T, start?: number, end?: number): this;
|
|
129
|
+
/** Determines whether an array includes a certain element, returning true or false as appropriate. */
|
|
130
|
+
includes(searchElement: T, fromIndex?: number): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Combines two or more arrays. This method returns a new array without modifying any existing arrays.
|
|
133
|
+
* @param items Additional arrays and/or items to add to the end of the array.
|
|
134
|
+
*/
|
|
135
|
+
concat(...items: (T | T[])[]): T[];
|
|
136
|
+
/** Calls a defined callback function on each element of an array, and returns an array that contains the results. */
|
|
137
|
+
map<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[];
|
|
138
|
+
/** Returns the elements of an array that meet the condition specified in a callback function. */
|
|
139
|
+
filter(predicate: (value: T, index: number, array: T[]) => unknown): T[];
|
|
140
|
+
/** Returns the value of the first element in the array where predicate is true, and null otherwise. */
|
|
141
|
+
find(predicate: (value: T, index: number, array: T[]) => unknown): T | null;
|
|
142
|
+
/** Determines whether the specified callback function returns true for any element of an array. */
|
|
143
|
+
some(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
|
|
144
|
+
/** Determines whether all the members of an array satisfy the specified test. */
|
|
145
|
+
every(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array.
|
|
148
|
+
*
|
|
149
|
+
* For example, -2 refers to the second to last element of the array.
|
|
150
|
+
* @param start The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.
|
|
151
|
+
* @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.
|
|
152
|
+
* */
|
|
153
|
+
slice(start?: number, end?: number): T[];
|
|
154
|
+
/**
|
|
155
|
+
* Removes elements from an array and returns the deleted elements.
|
|
156
|
+
*
|
|
157
|
+
* For example, -2 refers to the second to last element of the array.
|
|
158
|
+
* @param start The zero-based location in the array from which to start removing elements
|
|
159
|
+
* @param end The number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array.
|
|
160
|
+
* */
|
|
161
|
+
splice(start: number, deleteCount?: number): T[];
|
|
162
|
+
/** Returns a string representation of an array. */
|
|
163
|
+
toString(): string;
|
|
164
|
+
[n: number]: T;
|
|
165
|
+
}
|
|
166
|
+
declare var Array: {
|
|
167
|
+
readonly prototype: Array<any>;
|
|
168
|
+
};
|
|
169
|
+
declare namespace GreyHack {
|
|
170
|
+
interface BlockChain {
|
|
171
|
+
classID: "blockchainLib";
|
|
172
|
+
/**
|
|
173
|
+
* Returns a number representing the total amount of mined coins.
|
|
174
|
+
*
|
|
175
|
+
* In case of an error, it will return a string with the details.
|
|
176
|
+
* @example
|
|
177
|
+
* const blockChain = includeLib("/lib/blockchain.so");
|
|
178
|
+
* if (!isType(blockChain, "blockchainLib"))
|
|
179
|
+
* exit("Failed to get blockchain.so");
|
|
180
|
+
*
|
|
181
|
+
* const mined = blockChain.amountMined("bitcoin");
|
|
182
|
+
* if (isType(mined, "string"))
|
|
183
|
+
* exit(`Coudn't get the amount of mined coin: ${mined}`);
|
|
184
|
+
*
|
|
185
|
+
* print(`There are ${mined} coins mined for this coin`);
|
|
186
|
+
*/
|
|
187
|
+
amountMined(coinName: string): number | string;
|
|
188
|
+
/**
|
|
189
|
+
* Returns a number representing the current unit value of the cryptocurrency.
|
|
190
|
+
*
|
|
191
|
+
* In case of an error, a string with the error details will be returned.
|
|
192
|
+
*/
|
|
193
|
+
coinPrice(coinName: string): number | string;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a wallet and returns a wallet object on success, which can be used to manage cryptocurrencies.
|
|
196
|
+
*
|
|
197
|
+
* In case of an error, it will return a string with the details.
|
|
198
|
+
*/
|
|
199
|
+
createWallet(user: string, password: string): Wallet | string;
|
|
200
|
+
/**
|
|
201
|
+
* Removes a cryptocurrency from the world. The credentials used in the creation of the cryptocurrency are required.
|
|
202
|
+
*
|
|
203
|
+
* On success, it will return a true.
|
|
204
|
+
*
|
|
205
|
+
* On failure, it will return a string containing details.
|
|
206
|
+
*/
|
|
207
|
+
deleteCoin(coinName: string, user: string, password: string): true | string;
|
|
208
|
+
/**
|
|
209
|
+
* Returns a coin object used to manage the currency.
|
|
210
|
+
*
|
|
211
|
+
* In case of an error, it will return a string with the details.
|
|
212
|
+
*/
|
|
213
|
+
getCoin(coinName: string, user: string, password: string): Coin | string;
|
|
214
|
+
/**
|
|
215
|
+
* Returns a string with the name of the coin owned by the player.
|
|
216
|
+
*
|
|
217
|
+
* In case of an error, it returns a string with details.
|
|
218
|
+
*/
|
|
219
|
+
getCoinName(user: string, password: string): string;
|
|
220
|
+
/** Returns a wallet object on success. In case of an error, it will return a string indicating the reason. */
|
|
221
|
+
loginWallet(user: string, password: string): Wallet | string;
|
|
222
|
+
/**
|
|
223
|
+
* Returns an object with the latest changes in the value of a specific cryptocurrency.
|
|
224
|
+
*
|
|
225
|
+
* The key of the object is an index represented by a number. The value is an array, where index 0 is the historical price of the coin and index 1 is the date when the price change occurred.
|
|
226
|
+
*
|
|
227
|
+
* If no coin exists with this name, the method will return null.
|
|
228
|
+
*/
|
|
229
|
+
showHistory(coinName: string): Record<number, [number, string]> | string | null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
1
232
|
declare namespace GreyHack {
|
|
2
233
|
interface Coin {
|
|
3
234
|
classID: "coin";
|
|
@@ -233,7 +464,7 @@ declare namespace GreyHack {
|
|
|
233
464
|
*
|
|
234
465
|
* If the provided username is empty, an error will be thrown, preventing any further script execution.
|
|
235
466
|
*/
|
|
236
|
-
changePassword(username: string, password: string):
|
|
467
|
+
changePassword(username: string, password: string): true | string;
|
|
237
468
|
/**
|
|
238
469
|
* Closes a program associated with the provided PID.
|
|
239
470
|
*
|
|
@@ -340,71 +571,284 @@ declare namespace GreyHack {
|
|
|
340
571
|
}
|
|
341
572
|
}
|
|
342
573
|
declare namespace GreyHack {
|
|
343
|
-
interface
|
|
344
|
-
classID: "
|
|
345
|
-
/** The parent folder of the current file or folder */
|
|
346
|
-
parent: FtpFile | null;
|
|
574
|
+
interface Crypto {
|
|
575
|
+
classID: "cryptoLib";
|
|
347
576
|
/**
|
|
348
|
-
* Returns
|
|
577
|
+
* Returns a string containing the password based on the file which was generated via aireplay.
|
|
349
578
|
*
|
|
350
|
-
* In case
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
*
|
|
579
|
+
* In case of failure, it will return null instead. If the provided path is empty, an error will be thrown, interrupting the script execution.
|
|
580
|
+
* @example
|
|
581
|
+
* const crypto = includeLib("/lib/crypto.so");
|
|
582
|
+
* if (!isType(crypto, "cryptoLib"))
|
|
583
|
+
* exit("Failed to load crypto");
|
|
355
584
|
*
|
|
356
|
-
*
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
interface File extends BaseFile {
|
|
361
|
-
classID: "file";
|
|
362
|
-
/** The parent folder of the current file or folder */
|
|
363
|
-
parent: File | null;
|
|
364
|
-
/** Indicates if the file is a binary and can be imported by other scripts */
|
|
365
|
-
allowImport: boolean;
|
|
366
|
-
/**
|
|
367
|
-
* Returns an array of files inside this folder.
|
|
585
|
+
* const capFile = computer.file(currentPath() + "/file.cap");
|
|
586
|
+
* if (!capFile)
|
|
587
|
+
* exit(".cap file doesn't exist in the current folder");
|
|
368
588
|
*
|
|
369
|
-
*
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Returns an array of folders inside this folder.
|
|
589
|
+
* const wifiPassword = crypto.aircrack(currentPath() + "/file.cap");
|
|
590
|
+
* if (wifiPassword === null)
|
|
591
|
+
* exit("Failed to crack wifi password");
|
|
374
592
|
*
|
|
375
|
-
*
|
|
593
|
+
* console.log(`The wifi password for ${best.essid} is: ${wifiPassword}`);
|
|
376
594
|
*/
|
|
377
|
-
|
|
595
|
+
aircrack(path: string): string | null;
|
|
378
596
|
/**
|
|
379
|
-
*
|
|
597
|
+
* Used to inject frames on wireless interfaces.
|
|
380
598
|
*
|
|
381
|
-
*
|
|
599
|
+
* Once the command with `Control+C` is stopped, it will save the captured information in a text file called `file.cap` in the path where the terminal is currently located.
|
|
382
600
|
*
|
|
383
|
-
*
|
|
601
|
+
* Alternatively, a maximum of captured acks can be specified for the command to stop automatically, saving the `file.cap` file as described above.
|
|
384
602
|
*
|
|
385
|
-
*
|
|
386
|
-
*/
|
|
387
|
-
chmod(perms: string, recursive?: boolean): string;
|
|
388
|
-
/**
|
|
389
|
-
* Returns a string representing the content of the file. To read a file, the user requires read access or being root.
|
|
603
|
+
* To figure out how many ACKs are required, you can use the following formula: `300000 / (Power + 15)`.
|
|
390
604
|
*
|
|
391
|
-
*
|
|
605
|
+
* If there is an error, a string will be returned with the message indicating the problem. On success, it will return null, it is advised though to verify that the capture file actually exists.
|
|
392
606
|
*
|
|
393
|
-
*
|
|
394
|
-
*/
|
|
395
|
-
getContent(): string | null;
|
|
396
|
-
/**
|
|
397
|
-
* Saves text into a file. The content will not get appended to the file; therefore, existing content will be overridden.
|
|
607
|
+
* In case any of the provided values deviate from the signature types or bssid/essid is empty, an error will be thrown preventing any further script execution.
|
|
398
608
|
*
|
|
399
|
-
*
|
|
609
|
+
* @example
|
|
610
|
+
* const crypto = includeLib("/lib/crypto.so");
|
|
611
|
+
* if (!isType(crypto, "cryptoLib")) exit("Failed to load crypto");
|
|
400
612
|
*
|
|
401
|
-
*
|
|
402
|
-
|
|
403
|
-
setContent(content: string): string | boolean | null;
|
|
404
|
-
/**
|
|
405
|
-
* Change the group related to this file.
|
|
613
|
+
* const airmonRes = crypto.airmon("start", "wlan0");
|
|
614
|
+
* if (airmonRes !== true) exit("Failed to start airmon: " + airmonRes);
|
|
406
615
|
*
|
|
407
|
-
*
|
|
616
|
+
* const computer = getShell().hostComputer;
|
|
617
|
+
* const networks = computer.wifiNetworks("wlan0") ?? [];
|
|
618
|
+
* const result: { bssid: string, pwr: number, essid: string; }[] = [];
|
|
619
|
+
* for (const network of networks) {
|
|
620
|
+
* const parsedItem = network.split(" ");
|
|
621
|
+
* result.push({
|
|
622
|
+
* bssid: parsedItem[0],
|
|
623
|
+
* pwr: parsedItem[1].slice(0, -1).toInt() as number,
|
|
624
|
+
* essid: parsedItem[2],
|
|
625
|
+
* });
|
|
626
|
+
* }
|
|
627
|
+
*
|
|
628
|
+
* result.sort("pwr", false);
|
|
629
|
+
*
|
|
630
|
+
* const best = result[0];
|
|
631
|
+
* const aireplayRes = crypto.aireplay(best.bssid, best.essid, 300000 / (best.pwr + 15));
|
|
632
|
+
* crypto.airmon("stop", "wlan0");
|
|
633
|
+
* if (isType(aireplayRes, "string")) exit(aireplayRes);
|
|
634
|
+
*
|
|
635
|
+
* const capFile = computer.file(currentPath() + "/file.cap");
|
|
636
|
+
* if (capFile)
|
|
637
|
+
* console.log(".cap file created!")
|
|
638
|
+
* else
|
|
639
|
+
* exit("Failed to create .cap file in the current folder");
|
|
640
|
+
*/
|
|
641
|
+
aireplay(bssid: string, essid: string, maxAcks?: number): string | null;
|
|
642
|
+
/**
|
|
643
|
+
* Enables or disables the monitor mode of a network device.
|
|
644
|
+
*
|
|
645
|
+
* Monitor mode can only be enabled on Wifi cards.
|
|
646
|
+
*
|
|
647
|
+
* If it wasn't possible to enable or disable the monitor mode, this method will return either false or a string with details. In case of success, it will return true.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* const crypto = includeLib("/lib/crypto.so");
|
|
651
|
+
* if (!isType(crypto, "cryptoLib")) exit("Failed to load crypto");
|
|
652
|
+
*
|
|
653
|
+
* const airmonRes = crypto.airmon("start", "wlan0");
|
|
654
|
+
* if (airmonRes === true)
|
|
655
|
+
* console.log("Monitoring mode switched successfully.")
|
|
656
|
+
* else
|
|
657
|
+
* exit("Failed to switch monitoring mode: " + airmonRes);
|
|
658
|
+
*/
|
|
659
|
+
airmon(option: "start" | "stop", device: netDevice): boolean | string;
|
|
660
|
+
/**
|
|
661
|
+
* Returns a decrypted password via the provided password MD5 hash.
|
|
662
|
+
*
|
|
663
|
+
* Keep in mind that this method is not decrypting a password but rather checking for existing passwords within the game world with a matching MD5 hash.
|
|
664
|
+
*
|
|
665
|
+
* So in case a password does not exist in the game world, the decryption will fail.
|
|
666
|
+
*
|
|
667
|
+
* On failure, this method will return null. Using this method in an SSH encryption process will cause an error to be thrown, aborting further script execution.
|
|
668
|
+
* @example
|
|
669
|
+
* const crypto = includeLib("/lib/crypto.so");
|
|
670
|
+
* if (!isType(crypto, "cryptoLib")) exit("Failed to load crypto.so");
|
|
671
|
+
*
|
|
672
|
+
* const computer = getShell().hostComputer;
|
|
673
|
+
* const passwdFile = computer.file("/etc/passwd");
|
|
674
|
+
* if (!passwdFile) exit("Failed to get passwd file");
|
|
675
|
+
*
|
|
676
|
+
* const lines = passwdFile.getContent()!.split(char(10));
|
|
677
|
+
* for (const line of lines) {
|
|
678
|
+
* const parsed = line.split(":");
|
|
679
|
+
* const username = parsed[0];
|
|
680
|
+
* const passwordhash = parsed[1];
|
|
681
|
+
*
|
|
682
|
+
* const password = crypto.decipher(passwordhash);
|
|
683
|
+
* print(`Password for user '${username}' is: ${password}`);
|
|
684
|
+
* }
|
|
685
|
+
*/
|
|
686
|
+
decipher(hash: string): string | null;
|
|
687
|
+
/**
|
|
688
|
+
* Decrypts the specified file using the provided key.
|
|
689
|
+
*
|
|
690
|
+
* On success, the method returns true. If decryption fails, a descriptive error message is returned as a string.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* const crypto = includeLib("/lib/crypto.so");
|
|
694
|
+
* if (!isType(crypto, "cryptoLib")) exit("Failed to load crypto");
|
|
695
|
+
*
|
|
696
|
+
* const decryptionResult = crypto.decrypt("/etc/passwd", "mySecretKey");
|
|
697
|
+
* if (isType(decryptionResult, "string"))
|
|
698
|
+
* console.log("Failed to decrypt file due to: " + decryptionResult);
|
|
699
|
+
* else
|
|
700
|
+
* console.log("File got decrypted!");
|
|
701
|
+
*/
|
|
702
|
+
decrypt(filePath: string, password: string): true | string;
|
|
703
|
+
/**
|
|
704
|
+
* Encrypts the specified file using the provided key.
|
|
705
|
+
*
|
|
706
|
+
* On success, the method returns true. If encryption fails, a descriptive error message is returned as a string.
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* const crypto = includeLib("/lib/crypto.so");
|
|
710
|
+
* if (!isType(crypto, "cryptoLib")) exit("Failed to load crypto");
|
|
711
|
+
*
|
|
712
|
+
* const encryptionResult = crypto.encrypt("/etc/passwd", "mySecretKey");
|
|
713
|
+
* if (isType(encryptionResult, "string"))
|
|
714
|
+
* console.log("Failed to encrypt file due to: " + encryptionResult);
|
|
715
|
+
* else
|
|
716
|
+
* console.log("File got encrypted!");
|
|
717
|
+
*/
|
|
718
|
+
encrypt(filePath: string, password: string): true | string;
|
|
719
|
+
/**
|
|
720
|
+
* Checks whether the specified file is encrypted.
|
|
721
|
+
*
|
|
722
|
+
* Returns true if the file is encrypted, or false if it is not. If the check fails (e.g., due to a missing or unreadable file), a descriptive error message is returned as a string.
|
|
723
|
+
*/
|
|
724
|
+
isEncrypted(filePath: string): boolean | string;
|
|
725
|
+
/**
|
|
726
|
+
* Returns an array of the existing users on the computer where the SMTP service is running.
|
|
727
|
+
*
|
|
728
|
+
* If these users also have an email account registered on the SMTP server, it will be indicated in the array.
|
|
729
|
+
*
|
|
730
|
+
* SMTP services are usually running on port 25. In case of failure, this method will return a string containing the cause.
|
|
731
|
+
*/
|
|
732
|
+
smtpUserList(ip: string, port: number): string[] | string;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
declare namespace GreyHack {
|
|
736
|
+
interface CtfEvent {
|
|
737
|
+
classID: "ctfEvent";
|
|
738
|
+
/** Returns string with the name of the CTF event creator. */
|
|
739
|
+
getCreatorName(): string;
|
|
740
|
+
/** Returns string with the CTF event description. */
|
|
741
|
+
getDescription(): string;
|
|
742
|
+
/** Returns string with the mail content of the CTF event. */
|
|
743
|
+
getMailContent(): string;
|
|
744
|
+
/** Returns string with the CTF event template. */
|
|
745
|
+
getTemplate(): string;
|
|
746
|
+
/** Returns a boolean indicating if the CTF event got completed successfully */
|
|
747
|
+
playerSuccess(): boolean;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
declare namespace GreyHack {
|
|
751
|
+
interface DebugLibrary {
|
|
752
|
+
classID: "debugLibrary";
|
|
753
|
+
/**
|
|
754
|
+
* Applies a patch containing corrected code to the specified text file at the provided path.
|
|
755
|
+
*
|
|
756
|
+
* Returns a string with the result of the operation.
|
|
757
|
+
*/
|
|
758
|
+
applyPatch(path: string): string;
|
|
759
|
+
/**
|
|
760
|
+
* Returns a list containing a single partial computer object if zero-day vulnerabilities are detected within the specified memory zone.
|
|
761
|
+
*
|
|
762
|
+
* If a file path is provided, a partial file object associated with this path will also be included in the array.
|
|
763
|
+
*
|
|
764
|
+
* Additionally, if this file is a library, its corresponding metaLib object is added to the returned array.
|
|
765
|
+
*
|
|
766
|
+
* In case of an error, a string with details is returned.
|
|
767
|
+
*/
|
|
768
|
+
payload(memZone: string): string | [Partial<Computer>];
|
|
769
|
+
payload(memZone: string, filePath: string): string | [Partial<Computer>, Partial<File>] | [Partial<Computer>, Partial<File>, MetaLib];
|
|
770
|
+
/**
|
|
771
|
+
* Scans the library in debug mode to identify potential code errors that may lead to vulnerabilities.
|
|
772
|
+
*
|
|
773
|
+
* If issues are detected, the relevant code snippets are printed. In case of an error, a string containing the error message is returned.
|
|
774
|
+
*/
|
|
775
|
+
scan(): string;
|
|
776
|
+
/**
|
|
777
|
+
* Conducts automated tests on the specified lines of code.
|
|
778
|
+
*
|
|
779
|
+
* If potential vulnerabilities are detected due to errors in these lines, this method will print partial objects that could be obtained by exploiting the vulnerability, along with the affected memory zone and detailed vulnerability information.
|
|
780
|
+
*
|
|
781
|
+
* In case of failure, this function returns a string with an error message.
|
|
782
|
+
*/
|
|
783
|
+
unitTesting(errorLines: number[]): string;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
declare namespace GreyHack {
|
|
787
|
+
interface FtpFile extends BaseFile {
|
|
788
|
+
classID: "ftpFile";
|
|
789
|
+
/** The parent folder of the current file or folder */
|
|
790
|
+
parent: FtpFile | null;
|
|
791
|
+
/**
|
|
792
|
+
* Returns an array of files inside this folder.
|
|
793
|
+
*
|
|
794
|
+
* In case the current entity is a file instead of a folder this method will return null, so it is advisable to first use the isFolder function before calling this method. In case the current folder gets deleted this method will return null as well.
|
|
795
|
+
*/
|
|
796
|
+
getFiles(): FtpFile[] | null;
|
|
797
|
+
/**
|
|
798
|
+
* Returns an array of folders inside this folder.
|
|
799
|
+
*
|
|
800
|
+
* In case the current entity is a file instead of a folder this method will return null, so it is advisable to first use the isFolder function before calling this method. In case the current folder gets deleted this method will return null as well.
|
|
801
|
+
*/
|
|
802
|
+
getFolders(): FtpFile[] | null;
|
|
803
|
+
}
|
|
804
|
+
interface File extends BaseFile {
|
|
805
|
+
classID: "file";
|
|
806
|
+
/** The parent folder of the current file or folder */
|
|
807
|
+
parent: File | null;
|
|
808
|
+
/** Indicates if the file is a binary and can be imported by other scripts */
|
|
809
|
+
allowImport: boolean;
|
|
810
|
+
/**
|
|
811
|
+
* Returns an array of files inside this folder.
|
|
812
|
+
*
|
|
813
|
+
* In case the current entity is a file instead of a folder this method will return null, so it is advisable to first use the isFolder function before calling this method. In case the current folder gets deleted this method will return null as well.
|
|
814
|
+
*/
|
|
815
|
+
getFiles(): File[] | null;
|
|
816
|
+
/**
|
|
817
|
+
* Returns an array of folders inside this folder.
|
|
818
|
+
*
|
|
819
|
+
* In case the current entity is a file instead of a folder this method will return null, so it is advisable to first use the isFolder function before calling this method. In case the current folder gets deleted this method will return null as well.
|
|
820
|
+
*/
|
|
821
|
+
getFolders(): File[] | null;
|
|
822
|
+
/**
|
|
823
|
+
* Modifies the file permissions.
|
|
824
|
+
*
|
|
825
|
+
* The format for applying permissions is as follows: `[references][operator][modes]`. The references type is defined through three possible types: user `u`, group `g`, and other `o`. The operator is used to define if permissions get added "+" or removed "-". There are three different modes that can be modified: read `r`, write `w`, and execute `x`. So, for example, `o-wrx` would remove all possible permissions for others. To add all permissions for others again, `o+wrx` would be used.
|
|
826
|
+
*
|
|
827
|
+
* In case the modification fails, this method will return a string containing information about the reason. Otherwise, an empty string is returned.
|
|
828
|
+
*
|
|
829
|
+
* @param recursive set the permissions recursively to every file inside this folder
|
|
830
|
+
*/
|
|
831
|
+
chmod(perms: string, recursive?: boolean): string;
|
|
832
|
+
/**
|
|
833
|
+
* Returns a string representing the content of the file. To read a file, the user requires read access or being root.
|
|
834
|
+
*
|
|
835
|
+
* Note that you cannot read a binary file. In case of failure, null will be returned.
|
|
836
|
+
*
|
|
837
|
+
* If this method is used within an SSH encryption process, an error will be thrown, preventing any further script execution.
|
|
838
|
+
*/
|
|
839
|
+
getContent(): string | null;
|
|
840
|
+
/**
|
|
841
|
+
* Saves text into a file. The content will not get appended to the file; therefore, existing content will be overridden.
|
|
842
|
+
*
|
|
843
|
+
* To set new content, the user requires write permissions or being root. Keep in mind that text files cannot exceed the character limit of 160,000. In case setting the content was successful, true will be returned. Otherwise, a string with details will be returned.
|
|
844
|
+
*
|
|
845
|
+
* If this method is used within an SSH encryption process, an error will be thrown, preventing any further script execution. If the permissions are lacking, this method will return false. In case the file gets deleted this method will return null.
|
|
846
|
+
*/
|
|
847
|
+
setContent(content: string): string | boolean | null;
|
|
848
|
+
/**
|
|
849
|
+
* Change the group related to this file.
|
|
850
|
+
*
|
|
851
|
+
* The group name cannot exceed 15 characters. Additionally either write permissions or being root is required. In case of failure, a string with details. On success, an empty string gets returned. In case the current file gets deleted, this method will return null.
|
|
408
852
|
*
|
|
409
853
|
* If the passed group value is empty, the group value is longer than 15 characters, or the passed recursive value deviates from its original type, an error will be thrown, preventing further script execution.
|
|
410
854
|
*
|
|
@@ -428,7 +872,7 @@ declare namespace GreyHack {
|
|
|
428
872
|
*
|
|
429
873
|
* If used within an SSH encryption process, if the new name exceeds 128 characters, or if the path is too long, an error will be thrown, interrupting script execution. If the current file is deleted, this method will return null.
|
|
430
874
|
*/
|
|
431
|
-
symlink(path: string, newName
|
|
875
|
+
symlink(path: string, newName: string): true | string | null;
|
|
432
876
|
}
|
|
433
877
|
interface BaseFile {
|
|
434
878
|
classID: "ftpFile" | "file";
|
|
@@ -457,7 +901,7 @@ declare namespace GreyHack {
|
|
|
457
901
|
*
|
|
458
902
|
* If this method is used within an SSH encryption process, the new name exceeds 128 characters, or the path is too long, an error will be thrown, causing an interruption of script execution. In case the current file gets deleted, this method will return null.
|
|
459
903
|
*/
|
|
460
|
-
copy(destFolder
|
|
904
|
+
copy(destFolder: string, newName: string): string | true | null;
|
|
461
905
|
/**
|
|
462
906
|
* Delete the current file.
|
|
463
907
|
*
|
|
@@ -466,7 +910,8 @@ declare namespace GreyHack {
|
|
|
466
910
|
* Note that deleting a file will leave a log entry.
|
|
467
911
|
*/
|
|
468
912
|
delete(): string;
|
|
469
|
-
/**
|
|
913
|
+
/**
|
|
914
|
+
* Returns a boolean indicating if the user who launched the script has the requested permissions.
|
|
470
915
|
*
|
|
471
916
|
* In case the file gets deleted, this method will return null instead.
|
|
472
917
|
*/
|
|
@@ -484,7 +929,7 @@ declare namespace GreyHack {
|
|
|
484
929
|
*
|
|
485
930
|
* If this method is used within an SSH encryption process, the new name exceeds 128 characters, or the path is too long, an error will be thrown, causing an interruption of script execution. In case the current file gets deleted, this method will return null.
|
|
486
931
|
*/
|
|
487
|
-
move(destFolder: string, newName
|
|
932
|
+
move(destFolder: string, newName: string): string | true | null;
|
|
488
933
|
/**
|
|
489
934
|
* Returns a string containing the file path. If the file has been deleted, this method will still return the path it had prior to deletion.
|
|
490
935
|
* @param symLinkOriginalPath return the original path of the linked file instead
|
|
@@ -504,6 +949,10 @@ declare namespace GreyHack {
|
|
|
504
949
|
declare var globals: any;
|
|
505
950
|
/** The parameters given to this script on launch */
|
|
506
951
|
declare var params: string[];
|
|
952
|
+
declare const console: {
|
|
953
|
+
readonly log: typeof GreyHack.print;
|
|
954
|
+
readonly clear: typeof GreyHack.clearScreen;
|
|
955
|
+
};
|
|
507
956
|
declare namespace GreyHack {
|
|
508
957
|
/** Returns a string with the name of the user who is executing the current script. */
|
|
509
958
|
function activeUser(): string;
|
|
@@ -598,7 +1047,8 @@ declare namespace GreyHack {
|
|
|
598
1047
|
* Using this method in a SSH encryption process will cause an error to be thrown preventing further script execution.
|
|
599
1048
|
*/
|
|
600
1049
|
function getCustomObject<T = object>(): T & Record<string, any>;
|
|
601
|
-
/**
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns by default the {@link Router router} to which the executing computer is connected to.
|
|
602
1052
|
*
|
|
603
1053
|
* Optionally an IP address can be provided. In case of failure `null` is returned.
|
|
604
1054
|
*
|
|
@@ -620,7 +1070,8 @@ declare namespace GreyHack {
|
|
|
620
1070
|
*/
|
|
621
1071
|
function getShell(): Shell;
|
|
622
1072
|
function getShell(username?: string, password?: string): Shell | null;
|
|
623
|
-
/**
|
|
1073
|
+
/**
|
|
1074
|
+
* Returns the switch on the local network whose IP address matches
|
|
624
1075
|
* @example
|
|
625
1076
|
* const switch = getSwitch("192.168.1.4");
|
|
626
1077
|
* if (switch) print("This device is a switch!");
|
|
@@ -753,7 +1204,8 @@ declare namespace GreyHack {
|
|
|
753
1204
|
function yield(): null;
|
|
754
1205
|
/** Returns the type of the object */
|
|
755
1206
|
function getType(value: any): string;
|
|
756
|
-
/**
|
|
1207
|
+
/**
|
|
1208
|
+
* Checks if the given object is of a specific type
|
|
757
1209
|
* @example
|
|
758
1210
|
* const metax = includeLib("/lib/metaxploit.so");
|
|
759
1211
|
* if (isType(metax, "MetaxploitLib")) {
|
|
@@ -872,38 +1324,173 @@ interface ClassIDMap {
|
|
|
872
1324
|
"wallet": GreyHack.Wallet;
|
|
873
1325
|
}
|
|
874
1326
|
type GameTypeMap = ClassIDMap & PrimitiveTypeMap;
|
|
1327
|
+
interface Math {
|
|
1328
|
+
/** Returns the value of pi to the precision of 6 */
|
|
1329
|
+
readonly PI: number;
|
|
1330
|
+
/** Returns the absolute value of number. */
|
|
1331
|
+
abs(value: number): number;
|
|
1332
|
+
/** Returns the inverse cosine (in radians) of a number. */
|
|
1333
|
+
acos(value: number): number;
|
|
1334
|
+
/** Returns the inverse sine (in radians) of a number. */
|
|
1335
|
+
asin(value: number): number;
|
|
1336
|
+
/** Returns the inverse tangent (in radians) of a number. */
|
|
1337
|
+
atan(y: number, x?: number | undefined): number;
|
|
1338
|
+
/** Returns number rounded up to the integer value of the provided number. */
|
|
1339
|
+
ceil(value: number): number;
|
|
1340
|
+
/** Returns number rounded down to the integer value of the provided number. */
|
|
1341
|
+
floor(value: number): number;
|
|
1342
|
+
/** Returns the cosine of a number in radians. */
|
|
1343
|
+
cos(value: number): number;
|
|
1344
|
+
/** Returns the sine of a number in radians. */
|
|
1345
|
+
sin(value: number): number;
|
|
1346
|
+
/** Returns the tangent of a number in radians. */
|
|
1347
|
+
tan(value: number): number;
|
|
1348
|
+
/** Returns the square root of a number. */
|
|
1349
|
+
sqrt(value: number): number;
|
|
1350
|
+
/** Returns 1 or -1 indicating the sign of the value passed or 0 if the value is 0 */
|
|
1351
|
+
sign(value: number): -1 | 0 | 1;
|
|
1352
|
+
/** Returns number rounded to the integer value of the provided number. */
|
|
1353
|
+
round(value: number, fixed?: number | undefined): number;
|
|
1354
|
+
/** Returns a random number between 0 and 1. Optionally a seed number can be provided. */
|
|
1355
|
+
random(seed?: number | undefined): number;
|
|
1356
|
+
/**
|
|
1357
|
+
* Returns the natural logarithm of a number.
|
|
1358
|
+
*
|
|
1359
|
+
* By default, the base is 10. Optionally the base can be changed.
|
|
1360
|
+
*/
|
|
1361
|
+
log(value: number, base?: number | undefined): number;
|
|
1362
|
+
/** Returns the smallest number of the given values */
|
|
1363
|
+
min(...values: number[]): number;
|
|
1364
|
+
/** Returns the largest number of the given values */
|
|
1365
|
+
max(...values: number[]): number;
|
|
1366
|
+
}
|
|
1367
|
+
declare var Math: Math;
|
|
875
1368
|
declare namespace GreyHack {
|
|
876
|
-
interface
|
|
877
|
-
classID: "
|
|
1369
|
+
interface MetaLib {
|
|
1370
|
+
classID: "MetaLib";
|
|
1371
|
+
/** The name of the library. An example of a name would be `init.so`. */
|
|
1372
|
+
libName: string;
|
|
1373
|
+
/** Version number of the library. An example of a version number would be `1.0.0`. */
|
|
1374
|
+
version: string;
|
|
878
1375
|
/**
|
|
879
|
-
*
|
|
1376
|
+
* Returns a library in debug mode as a {@link DebugLibrary} object.
|
|
880
1377
|
*
|
|
881
|
-
*
|
|
882
|
-
|
|
883
|
-
|
|
1378
|
+
* A valid Neurobox engineer's username and password are required to access this mode.
|
|
1379
|
+
*
|
|
1380
|
+
* If successful, the {@link DebugLibrary} object is returned; in case of an error, a string with details is provided. */
|
|
1381
|
+
debugTools(user: string, password: string): DebugLibrary | string;
|
|
884
1382
|
/**
|
|
885
|
-
*
|
|
1383
|
+
* Returns by default a boolean indicating whether the library has been patched.
|
|
886
1384
|
*
|
|
887
|
-
*
|
|
1385
|
+
* True indicates that the library has been patched, while false indicates that it has not.
|
|
888
1386
|
*
|
|
889
|
-
* If the
|
|
1387
|
+
* If the getdate parameter is set to true, the function will return a string containing the date of the last patch. The data format is as follows: `dd/MM/yyyy`.
|
|
1388
|
+
*
|
|
1389
|
+
* Additionally if there is any error the return value will be a string.
|
|
890
1390
|
*/
|
|
891
|
-
|
|
1391
|
+
isPatched(getDate?: boolean): boolean | string;
|
|
892
1392
|
/**
|
|
893
|
-
*
|
|
1393
|
+
* Exploits vulnerabilities in target systems by executing various attack vectors against libraries located in the `/lib` folder.
|
|
894
1394
|
*
|
|
895
|
-
*
|
|
1395
|
+
* The function requires a memory address, vulnerability identifier, and optional arguments that are mandatory for password changes (new password) and computer exploits (LAN IP address).
|
|
896
1396
|
*
|
|
897
|
-
*
|
|
1397
|
+
* The system validates that the target library exists and is properly located in the `/lib` directory before proceeding otherwise it will return null.
|
|
1398
|
+
*
|
|
1399
|
+
* If the network where the library is located is disabled, the function returns a string indicating the network status.
|
|
1400
|
+
*
|
|
1401
|
+
* The exploit will fail and return null if the target is behind a firewall or if any of the specific vulnerability requirements aren't met, such as insufficient registered users, missing required libraries with correct versions, inadequate port forwards, absence of required user types like active guests or root users, or invalid file paths.
|
|
1402
|
+
*
|
|
1403
|
+
* If the target vulnerability is identified as a zero-day exploit, the system will load the appropriate zero-day vulnerability before execution.
|
|
1404
|
+
*
|
|
1405
|
+
* During execution, if a super admin intercepts the exploit attempt, user privileges are automatically lowered to guest level.
|
|
1406
|
+
*
|
|
1407
|
+
* Shell exploits, once all requirements are met, always return a shell object.
|
|
1408
|
+
*
|
|
1409
|
+
* Random folder exploits return a file object if the specified path exists or null if the folder cannot be found.
|
|
1410
|
+
*
|
|
1411
|
+
* Password change exploits return true for successful password modification or false for failure due to guest user restrictions, invalid alphanumeric format, or exceeding the 15-character limit.
|
|
1412
|
+
*
|
|
1413
|
+
* Settings override exploits work only on smart appliances like fridges or microwaves and return true for success or false for failure.
|
|
1414
|
+
*
|
|
1415
|
+
* Traffic light exploits require targets on the police station's network and return true for success or false for failure.
|
|
1416
|
+
*
|
|
1417
|
+
* Firewall exploits need router targets and return true for success or false for failure.
|
|
1418
|
+
*
|
|
1419
|
+
* Computer exploits return a computer object when successful or false if the LAN IP is invalid, the computer doesn't exist, or no non-root user is available.
|
|
1420
|
+
*
|
|
1421
|
+
* Using {@link isType} or {@link getType} to verify return value types is essential before processing results due to the variety of possible return types.
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1425
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1426
|
+
*
|
|
1427
|
+
* const metaLib = metax.load("/lib/init.so");
|
|
1428
|
+
* if (!metaLib) exit("Failed to load the library");
|
|
1429
|
+
*
|
|
1430
|
+
* const result = metaLib.overflow("0x14F45286", "Eyworde");
|
|
1431
|
+
* if (isType(result, "shell")) {
|
|
1432
|
+
* // Do stuff with shell
|
|
1433
|
+
* }
|
|
1434
|
+
* else if (isType(result, "computer")) {
|
|
1435
|
+
* // Do stuff with computer
|
|
1436
|
+
* }
|
|
1437
|
+
* else if (isType(result, "file")) {
|
|
1438
|
+
* // Do stuff with file
|
|
1439
|
+
* console.log("Obtained file: " + result.name);
|
|
1440
|
+
* }
|
|
898
1441
|
*/
|
|
899
|
-
|
|
1442
|
+
overflow(memoryAddress: string, unsecZone: string, optArgs?: string): Shell | Computer | File | string | boolean | null;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
declare namespace GreyHack {
|
|
1446
|
+
interface MetaMail {
|
|
1447
|
+
classID: "MetaMail";
|
|
1448
|
+
/**
|
|
1449
|
+
* Delete the email corresponding to the provided email ID.
|
|
1450
|
+
*
|
|
1451
|
+
* Returns true if the email removal was successful. Otherwise, a string with an error message will be returned.
|
|
1452
|
+
*/
|
|
1453
|
+
delete(mailId: string): true | string;
|
|
1454
|
+
/**
|
|
1455
|
+
* Returns an array where each item is a string containing mail id, from, subject and a small preview of the content consisting of the first 125 characters.
|
|
1456
|
+
*
|
|
1457
|
+
* If there is any issue a string will be returned with details.
|
|
1458
|
+
*/
|
|
1459
|
+
fetch(): string[] | string;
|
|
1460
|
+
/**
|
|
1461
|
+
* Returns a string containing the content of a mail related to the provided mail id.
|
|
1462
|
+
*
|
|
1463
|
+
* The mail id argument can be obtained with fetch. In case the mail cannot be found this method will return `Mail not found`.
|
|
1464
|
+
*/
|
|
1465
|
+
read(mailId: string): string;
|
|
1466
|
+
/**
|
|
1467
|
+
* Send a new mail to the provided email address.
|
|
1468
|
+
*
|
|
1469
|
+
* Keep in mind that the subject can not exceed 128 characters and the message size should not exceed 2500 characters.
|
|
1470
|
+
*
|
|
1471
|
+
* @returns true indicating that the mail has been sent correctly, or a string with an error
|
|
1472
|
+
*/
|
|
1473
|
+
send(emailAddress: string, subject: string, message: string): string | true;
|
|
900
1474
|
}
|
|
1475
|
+
}
|
|
1476
|
+
declare namespace GreyHack {
|
|
901
1477
|
interface Metaxploit {
|
|
902
1478
|
classID: "MetaxploitLib";
|
|
903
1479
|
/**
|
|
904
1480
|
* Returns a {@link MetaLib} object for the provided path to the library binary. Keep in mind that this can only be used on library files.
|
|
905
1481
|
*
|
|
906
1482
|
* On failure, this method will return null. If the provided path is empty, this method will throw a runtime exception, preventing further script execution.
|
|
1483
|
+
* @example
|
|
1484
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1485
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1486
|
+
*
|
|
1487
|
+
* const libFolder = getShell().hostComputer.file("/lib")!;
|
|
1488
|
+
* for (const file of libFolder.getFiles()!) {
|
|
1489
|
+
* const metaLib = metax.load(file.path());
|
|
1490
|
+
* if (!metaLib) continue; // Failed to load
|
|
1491
|
+
*
|
|
1492
|
+
* console.log(`Library: ${metaLib.libName}-${metaLib.version}`);
|
|
1493
|
+
* }
|
|
907
1494
|
*/
|
|
908
1495
|
load(path: string): MetaLib | null;
|
|
909
1496
|
/**
|
|
@@ -913,7 +1500,26 @@ declare namespace GreyHack {
|
|
|
913
1500
|
*
|
|
914
1501
|
* The main purpose of this method is to gain a {@link NetSession} and then use {@link NetSession.dumpLib} to receive a {@link MetaLib} object to exploit vulnerabilities.
|
|
915
1502
|
*
|
|
916
|
-
* In case of failure, this method will return null. If this method is used within an SSH encryption process or with disabled internet, or if an invalid target IP is provided, this method will throw a runtime exception.
|
|
1503
|
+
* In case of failure, this method will return null. If this method is used within an SSH encryption process or with disabled internet, or if an invalid target IP is provided, this method will throw a runtime exception.
|
|
1504
|
+
*
|
|
1505
|
+
* @example
|
|
1506
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1507
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1508
|
+
*
|
|
1509
|
+
* const targetRouter = getRouter("1.1.1.1");
|
|
1510
|
+
* if (!targetRouter) exit("Failed to get target router");
|
|
1511
|
+
*
|
|
1512
|
+
* const ports = targetRouter.usedPorts();
|
|
1513
|
+
* for (const port of ports) {
|
|
1514
|
+
* if (port.isClosed()) continue;
|
|
1515
|
+
*
|
|
1516
|
+
* const netSession = metax.netUse(targetRouter.publicIp, port.portNumber);
|
|
1517
|
+
* if (!netSession) continue;
|
|
1518
|
+
*
|
|
1519
|
+
* const metaLib = netSession.dumpLib();
|
|
1520
|
+
* console.log(`Library: ${metaLib.libName}-${metaLib.version}`);
|
|
1521
|
+
* }
|
|
1522
|
+
*/
|
|
917
1523
|
netUse(ip: string, port: number): NetSession | null;
|
|
918
1524
|
/**
|
|
919
1525
|
* Launches a process on the victim's computer, silently attempting to continuously connect in the background to the specified address and port.
|
|
@@ -921,15 +1527,36 @@ declare namespace GreyHack {
|
|
|
921
1527
|
* For the reverse shell to run successfully, the rshell service must be installed, and the port forward must be configured correctly on the machine where the server is waiting for the victim's connection.
|
|
922
1528
|
*
|
|
923
1529
|
* If the launch was successful, true will be returned. In case of failure, a string with details will be returned.
|
|
1530
|
+
*
|
|
1531
|
+
* @example
|
|
1532
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1533
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1534
|
+
*
|
|
1535
|
+
* const result = metax.rshellClient("1.1.1.1", 1222, "bgprocess");
|
|
1536
|
+
* if (isType(result, "string"))
|
|
1537
|
+
* console.log("Failed to launch rshell client: " + result);
|
|
924
1538
|
*/
|
|
925
1539
|
rshellClient(ip: string, port: number, processName?: string): true | string;
|
|
926
|
-
/**
|
|
1540
|
+
/**
|
|
1541
|
+
* This method returns an array of {@link Shell} objects that have been reverse shell connected to this computer.
|
|
927
1542
|
*
|
|
928
1543
|
* To manage the connections received, the rshell service must be installed on the machine that receives the victims' connections.
|
|
929
1544
|
*
|
|
930
|
-
* In case of failure a string will be returned with details.
|
|
1545
|
+
* In case of failure a string will be returned with details.
|
|
1546
|
+
*
|
|
1547
|
+
* @example
|
|
1548
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1549
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1550
|
+
*
|
|
1551
|
+
* const shells = metax.rshellServer();
|
|
1552
|
+
* if (isType(shells, "string"))
|
|
1553
|
+
* exit("Failed to get reverse shells: " + shells)
|
|
1554
|
+
*
|
|
1555
|
+
* console.log(`You have access to ${shells.length} shells`);
|
|
1556
|
+
*/
|
|
931
1557
|
rshellServer(): Shell[] | string;
|
|
932
|
-
/**
|
|
1558
|
+
/**
|
|
1559
|
+
* Returns an array where each item is a string representing a memory area which has vulnerabilities related to the provided library.
|
|
933
1560
|
*
|
|
934
1561
|
* These memory areas can be used to make further scans via {@link Metaxploit.scanAddress}.
|
|
935
1562
|
*
|
|
@@ -937,7 +1564,19 @@ declare namespace GreyHack {
|
|
|
937
1564
|
*
|
|
938
1565
|
* An example of a memory area would be `0x7BFC1EAA`.
|
|
939
1566
|
*
|
|
940
|
-
* Using this method within a SSH encryption process will throw a runtime exception.
|
|
1567
|
+
* Using this method within a SSH encryption process will throw a runtime exception.
|
|
1568
|
+
* @example
|
|
1569
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1570
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1571
|
+
*
|
|
1572
|
+
* const metaLib = metax.load("/lib/init.so");
|
|
1573
|
+
* if (!metaLib) exit("Failed to load the library");
|
|
1574
|
+
*
|
|
1575
|
+
* const addresses = metax.scan(metaLib) ?? [];
|
|
1576
|
+
* for (const address of addresses) {
|
|
1577
|
+
* console.log("Memory address containing a vulnerability: " + address);
|
|
1578
|
+
* }
|
|
1579
|
+
*/
|
|
941
1580
|
scan(metaLib: MetaLib): string[] | null;
|
|
942
1581
|
/**
|
|
943
1582
|
* Returns a string containing information about each vulnerability in the provided library and memory area.
|
|
@@ -945,6 +1584,30 @@ declare namespace GreyHack {
|
|
|
945
1584
|
* In case the scanning fails this method will return null.
|
|
946
1585
|
*
|
|
947
1586
|
* Using this method within a SSH encryption process will throw a runtime exception.
|
|
1587
|
+
*
|
|
1588
|
+
* @example
|
|
1589
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1590
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1591
|
+
*
|
|
1592
|
+
* const metaLib = metax.load("/lib/init.so");
|
|
1593
|
+
* if (!metaLib) exit("Failed to load the library");
|
|
1594
|
+
*
|
|
1595
|
+
* const addresses = metax.scan(metaLib) ?? [];
|
|
1596
|
+
* for (const address of addresses) {
|
|
1597
|
+
* const info = metax.scanAddress(metaLib, address);
|
|
1598
|
+
* if (!info) continue;
|
|
1599
|
+
*
|
|
1600
|
+
* const segments = info.split("Unsafe check: ").slice(1);
|
|
1601
|
+
* for (const segment of segments) {
|
|
1602
|
+
* const labelStart = segment.indexOf("<b>")!;
|
|
1603
|
+
* const labelEnd = segment.indexOf("</b>")!;
|
|
1604
|
+
*
|
|
1605
|
+
* const unsecZone = segment.slice(labelStart + 3, labelEnd);
|
|
1606
|
+
*
|
|
1607
|
+
* const result = metaLib.overflow(address, unsecZone);
|
|
1608
|
+
* // Do stuff with result...
|
|
1609
|
+
* }
|
|
1610
|
+
* }
|
|
948
1611
|
*/
|
|
949
1612
|
scanAddress(metaLib: MetaLib, memoryAddress: string): string | null;
|
|
950
1613
|
/**
|
|
@@ -957,382 +1620,101 @@ declare namespace GreyHack {
|
|
|
957
1620
|
* In case the operation fails this method will return null.
|
|
958
1621
|
*
|
|
959
1622
|
* Using this method within a SSH encryption process will throw a runtime exception.
|
|
960
|
-
*/
|
|
961
|
-
sniffer(saveEncSource?: boolean): string | null;
|
|
962
|
-
}
|
|
963
|
-
interface MetaLib {
|
|
964
|
-
classID: "MetaLib";
|
|
965
|
-
/** The name of the library. An example of a name would be `init.so`. */
|
|
966
|
-
libName: string;
|
|
967
|
-
/** Version number of the library. An example of a version number would be `1.0.0`. */
|
|
968
|
-
version: string;
|
|
969
|
-
/**
|
|
970
|
-
* Returns a library in debug mode as a {@link DebugLibrary} object.
|
|
971
|
-
*
|
|
972
|
-
* A valid Neurobox engineer's username and password are required to access this mode.
|
|
973
1623
|
*
|
|
974
|
-
*
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
* Returns by default a boolean indicating whether the library has been patched.
|
|
978
|
-
*
|
|
979
|
-
* True indicates that the library has been patched, while false indicates that it has not.
|
|
980
|
-
*
|
|
981
|
-
* If the getdate parameter is set to true, the function will return a string containing the date of the last patch. The data format is as follows: `dd/MM/yyyy`.
|
|
1624
|
+
* @example
|
|
1625
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1626
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
982
1627
|
*
|
|
983
|
-
*
|
|
1628
|
+
* metax.sniffer()
|
|
984
1629
|
*/
|
|
985
|
-
|
|
1630
|
+
sniffer(saveEncSource?: boolean): string | null;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
declare namespace GreyHack {
|
|
1634
|
+
interface NetSession {
|
|
1635
|
+
classID: "NetSession";
|
|
986
1636
|
/**
|
|
987
|
-
*
|
|
988
|
-
*
|
|
989
|
-
* The function requires a memory address, vulnerability identifier, and optional arguments that are mandatory for password changes (new password) and computer exploits (LAN IP address).
|
|
990
|
-
*
|
|
991
|
-
* The system validates that the target library exists and is properly located in the `/lib` directory before proceeding otherwise it will return null.
|
|
992
|
-
*
|
|
993
|
-
* If the network where the library is located is disabled, the function returns a string indicating the network status.
|
|
994
|
-
*
|
|
995
|
-
* The exploit will fail and return null if the target is behind a firewall or if any of the specific vulnerability requirements aren't met, such as insufficient registered users, missing required libraries with correct versions, inadequate port forwards, absence of required user types like active guests or root users, or invalid file paths.
|
|
996
|
-
*
|
|
997
|
-
* If the target vulnerability is identified as a zero-day exploit, the system will load the appropriate zero-day vulnerability before execution.
|
|
998
|
-
*
|
|
999
|
-
* During execution, if a super admin intercepts the exploit attempt, user privileges are automatically lowered to guest level.
|
|
1000
|
-
*
|
|
1001
|
-
* Shell exploits, once all requirements are met, always return a shell object.
|
|
1002
|
-
*
|
|
1003
|
-
* Random folder exploits return a file object if the specified path exists or null if the folder cannot be found.
|
|
1637
|
+
* Returns the {@link MetaLib} associated with the remote service.
|
|
1004
1638
|
*
|
|
1005
|
-
*
|
|
1639
|
+
* For example if the {@link Metaxploit} method netUse was used on a ssh port it will return the MetaLib related to the ssh service. In case the port was zero is will return a MetaLib related to the kernel router.
|
|
1006
1640
|
*
|
|
1007
|
-
*
|
|
1641
|
+
* @example
|
|
1642
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1643
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1008
1644
|
*
|
|
1009
|
-
*
|
|
1645
|
+
* const targetRouter = getRouter("1.1.1.1");
|
|
1646
|
+
* if (!targetRouter) exit("Failed to get target router");
|
|
1010
1647
|
*
|
|
1011
|
-
*
|
|
1648
|
+
* const ports = targetRouter.usedPorts();
|
|
1649
|
+
* for (const port of ports) {
|
|
1650
|
+
* if (port.isClosed()) continue;
|
|
1012
1651
|
*
|
|
1013
|
-
*
|
|
1652
|
+
* const netSession = metax.netUse(targetRouter.publicIp, port.portNumber);
|
|
1653
|
+
* if (!netSession) continue;
|
|
1014
1654
|
*
|
|
1015
|
-
*
|
|
1655
|
+
* const metaLib = netSession.dumpLib();
|
|
1656
|
+
* console.log(`Library: ${metaLib.libName}-${metaLib.version}`);
|
|
1657
|
+
* }
|
|
1016
1658
|
*/
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
classID: "debugLibrary";
|
|
1021
|
-
/** Applies a patch containing corrected code to the specified text file at the provided path.
|
|
1022
|
-
*
|
|
1023
|
-
* Returns a string with the result of the operation. */
|
|
1024
|
-
applyPatch(path: string): string;
|
|
1025
|
-
/** Returns a list containing a single partial computer object if zero-day vulnerabilities are detected within the specified memory zone.
|
|
1026
|
-
*
|
|
1027
|
-
* If a file path is provided, a partial file object associated with this path will also be included in the array.
|
|
1028
|
-
*
|
|
1029
|
-
* Additionally, if this file is a library, its corresponding metaLib object is added to the returned array.
|
|
1030
|
-
*
|
|
1031
|
-
* In case of an error, a string with details is returned. */
|
|
1032
|
-
payload(memZone: string): string | [Partial<Computer>];
|
|
1033
|
-
payload(memZone: string, filePath: string): string | [Partial<Computer>, Partial<File>] | [Partial<Computer>, Partial<File>, MetaLib];
|
|
1034
|
-
/** Scans the library in debug mode to identify potential code errors that may lead to vulnerabilities.
|
|
1035
|
-
*
|
|
1036
|
-
* If issues are detected, the relevant code snippets are printed. In case of an error, a string containing the error message is returned. */
|
|
1037
|
-
scan(): string;
|
|
1038
|
-
/** Conducts automated tests on the specified lines of code.
|
|
1039
|
-
*
|
|
1040
|
-
* If potential vulnerabilities are detected due to errors in these lines, this method will print partial objects that could be obtained by exploiting the vulnerability, along with the affected memory zone and detailed vulnerability information.
|
|
1041
|
-
*
|
|
1042
|
-
* In case of failure, this function returns a string with an error message. */
|
|
1043
|
-
unitTesting(errorLines: number[]): string;
|
|
1044
|
-
}
|
|
1045
|
-
interface Crypto {
|
|
1046
|
-
classID: "cryptoLib";
|
|
1047
|
-
/** Returns a string containing the password based on the file which was generated via aireplay.
|
|
1048
|
-
*
|
|
1049
|
-
* In case of failure, it will return null instead. If the provided path is empty, an error will be thrown, interrupting the script execution. */
|
|
1050
|
-
aircrack(path: string): string | null;
|
|
1051
|
-
/** Used to inject frames on wireless interfaces.
|
|
1052
|
-
*
|
|
1053
|
-
* Once the command with `Control+C` is stopped, it will save the captured information in a text file called `file.cap` in the path where the terminal is currently located.
|
|
1054
|
-
*
|
|
1055
|
-
* Alternatively, a maximum of captured acks can be specified for the command to stop automatically, saving the `file.cap` file as described above.
|
|
1659
|
+
dumpLib(): MetaLib;
|
|
1660
|
+
/**
|
|
1661
|
+
* Initiates a DDoS attack targeting the computer associated with the currently active NetSession object.
|
|
1056
1662
|
*
|
|
1057
|
-
* To
|
|
1663
|
+
* To successfully force a reboot, there must be at least 4 concurrent floodConnection calls for every 1 unit of net speed on the target computer. Keep in mind that these calls need to come from different IPs. So for example PackS would require 12 active floodConnection calls. If the threshold is met, the target computer will be forced to reboot, and the terminal will output: `remote connection interrupted`.
|
|
1058
1664
|
*
|
|
1059
|
-
*
|
|
1665
|
+
* This method always returns null and only prints a message upon a successful attack.
|
|
1060
1666
|
*
|
|
1061
|
-
*
|
|
1062
|
-
|
|
1063
|
-
|
|
1667
|
+
* @example
|
|
1668
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1669
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1064
1670
|
*
|
|
1065
|
-
*
|
|
1671
|
+
* const targetRouter = getRouter("1.1.1.1");
|
|
1672
|
+
* if (!targetRouter) exit("Failed to get target router");
|
|
1066
1673
|
*
|
|
1067
|
-
*
|
|
1068
|
-
|
|
1069
|
-
|
|
1674
|
+
* const ports = targetRouter.usedPorts();
|
|
1675
|
+
* for (const port of ports) {
|
|
1676
|
+
* if (port.isClosed()) continue;
|
|
1070
1677
|
*
|
|
1071
|
-
*
|
|
1678
|
+
* const netSession = metax.netUse(targetRouter.publicIp, port.portNumber);
|
|
1679
|
+
* if (!netSession) continue;
|
|
1072
1680
|
*
|
|
1073
|
-
*
|
|
1681
|
+
* netSession.floodConnection();
|
|
1682
|
+
* }
|
|
1683
|
+
*/
|
|
1684
|
+
floodConnection(): null;
|
|
1685
|
+
/**
|
|
1686
|
+
* Returns the number of devices using this router as a gateway. If you obtained your NetSession from a computer, it will fetch and return the value from its gateway router.
|
|
1074
1687
|
*
|
|
1075
|
-
* On failure, this method will return null. Using this method in an SSH encryption process will cause an error to be thrown, aborting further script execution.
|
|
1076
1688
|
* @example
|
|
1077
|
-
* const
|
|
1078
|
-
* if (!isType(
|
|
1079
|
-
*
|
|
1080
|
-
* const computer = getShell().hostComputer;
|
|
1081
|
-
* const passwdFile = computer.file("/etc/passwd");
|
|
1082
|
-
* if (!passwdFile) exit("Failed to get passwd file");
|
|
1689
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1690
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1083
1691
|
*
|
|
1084
|
-
* const
|
|
1085
|
-
*
|
|
1086
|
-
* const parsed = line.split(":");
|
|
1087
|
-
* const username = parsed[0];
|
|
1088
|
-
* const passwordhash = parsed[1];
|
|
1692
|
+
* const targetRouter = getRouter("1.1.1.4");
|
|
1693
|
+
* if (!targetRouter) exit("Failed to get target router");
|
|
1089
1694
|
*
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1695
|
+
* const ports = targetRouter.usedPorts();
|
|
1696
|
+
* const netSession = metax.netUse(targetRouter.publicIp, ports[0].portNumber);
|
|
1697
|
+
* if (netSession) {
|
|
1698
|
+
* console.log("Gateway clients: " + netSession.getNumConnGateway())
|
|
1092
1699
|
* }
|
|
1093
1700
|
*/
|
|
1094
|
-
|
|
1095
|
-
/**
|
|
1096
|
-
*
|
|
1097
|
-
* On success, the method returns true. If decryption fails, a descriptive error message is returned as a string. */
|
|
1098
|
-
decrypt(filePath: string, password: string): true | string;
|
|
1099
|
-
/** Encrypts the specified file using the provided key.
|
|
1100
|
-
*
|
|
1101
|
-
* On success, the method returns true. If encryption fails, a descriptive error message is returned as a string. */
|
|
1102
|
-
encrypt(filePath: string, password: string): true | string;
|
|
1103
|
-
/** Checks whether the specified file is encrypted.
|
|
1104
|
-
*
|
|
1105
|
-
* Returns true if the file is encrypted, or zero if it is not. If the check fails (e.g., due to a missing or unreadable file), a descriptive error message is returned as a string. */
|
|
1106
|
-
isEncrypted(filePath: string): boolean | string;
|
|
1107
|
-
/** Returns an array of the existing users on the computer where the SMTP service is running.
|
|
1108
|
-
*
|
|
1109
|
-
* If these users also have an email account registered on the SMTP server, it will be indicated in the array.
|
|
1110
|
-
*
|
|
1111
|
-
* SMTP services are usually running on port 25. In case of failure, this method will return a string containing the cause. */
|
|
1112
|
-
smtpUserList(ip: string, port: number): string[] | string;
|
|
1113
|
-
}
|
|
1114
|
-
interface BlockChain {
|
|
1115
|
-
classID: "blockchainLib";
|
|
1116
|
-
/** Returns a number representing the total amount of mined coins.
|
|
1701
|
+
getNumConnGateway(): number;
|
|
1702
|
+
/**
|
|
1703
|
+
* Returns the number of ports forwarded by this router. If you obtained your NetSession from a computer, it will fetch and return the value from its gateway router.
|
|
1117
1704
|
*
|
|
1118
|
-
* In case of an error, it will return a string with the details.
|
|
1119
1705
|
* @example
|
|
1120
|
-
* const
|
|
1121
|
-
* if (!isType(
|
|
1122
|
-
* exit("Failed to get blockchain.so");
|
|
1706
|
+
* const metax = includeLib("/lib/metaxploit.so");
|
|
1707
|
+
* if (!isType(metax, "MetaxploitLib")) exit("Failed to get metaxploit");
|
|
1123
1708
|
*
|
|
1124
|
-
* const
|
|
1125
|
-
* if (
|
|
1126
|
-
* exit(`Coudn't get the amount of mined coin: ${mined}`);
|
|
1709
|
+
* const targetRouter = getRouter("1.1.1.4");
|
|
1710
|
+
* if (!targetRouter) exit("Failed to get target router");
|
|
1127
1711
|
*
|
|
1128
|
-
*
|
|
1712
|
+
* const ports = targetRouter.usedPorts();
|
|
1713
|
+
* const netSession = metax.netUse(targetRouter.publicIp, ports[0].portNumber);
|
|
1714
|
+
* if (netSession) {
|
|
1715
|
+
* console.log("Port forwards: " + netSession.getNumPortforward())
|
|
1716
|
+
* }
|
|
1129
1717
|
*/
|
|
1130
|
-
amountMined(coinName: string): number | string;
|
|
1131
|
-
/** Returns a number representing the current unit value of the cryptocurrency.
|
|
1132
|
-
*
|
|
1133
|
-
* In case of an error, a string with the error details will be returned. */
|
|
1134
|
-
coinPrice(coinName: string): number | string;
|
|
1135
|
-
/** Creates a wallet and returns a wallet object on success, which can be used to manage cryptocurrencies.
|
|
1136
|
-
*
|
|
1137
|
-
* In case of an error, it will return a string with the details. */
|
|
1138
|
-
createWallet(user: string, password: string): Wallet | string;
|
|
1139
|
-
/** Removes a cryptocurrency from the world. The credentials used in the creation of the cryptocurrency are required.
|
|
1140
|
-
*
|
|
1141
|
-
* On success, it will return a true.
|
|
1142
|
-
*
|
|
1143
|
-
* On failure, it will return a string containing details. */
|
|
1144
|
-
deleteCoin(coinName: string, user: string, password: string): true | string;
|
|
1145
|
-
/** Returns a coin object used to manage the currency.
|
|
1146
|
-
*
|
|
1147
|
-
* In case of an error, it will return a string with the details. */
|
|
1148
|
-
getCoin(coinName: string, user: string, password: string): Coin | string;
|
|
1149
|
-
/** Returns a string with the name of the coin owned by the player.
|
|
1150
|
-
*
|
|
1151
|
-
* In case of an error, it returns a string with details. */
|
|
1152
|
-
getCoinName(user: string, password: string): string;
|
|
1153
|
-
/** Returns a wallet object on success. In case of an error, it will return a string indicating the reason. */
|
|
1154
|
-
loginWallet(user: string, password: string): Wallet | string;
|
|
1155
|
-
/** Returns an object with the latest changes in the value of a specific cryptocurrency.
|
|
1156
|
-
*
|
|
1157
|
-
* The key of the object is an index represented by a number. The value is an array, where index 0 is the historical price of the coin and index 1 is the date when the price change occurred.
|
|
1158
|
-
*
|
|
1159
|
-
* If no coin exists with this name, the method will return null. */
|
|
1160
|
-
showHistory(coinName: string): Record<number, [number, string]> | string | null;
|
|
1161
|
-
}
|
|
1162
|
-
interface AptClient {
|
|
1163
|
-
classID: "aptClientLib";
|
|
1164
|
-
/** Inserts a repository address into the `/etc/apt/sources.txt` file.
|
|
1165
|
-
*
|
|
1166
|
-
* On success, it will return an empty string. In case of failure, it will return a string with an error message.
|
|
1167
|
-
*/
|
|
1168
|
-
addRepo(repositoryAddress: string, port?: number): string;
|
|
1169
|
-
/** Checks if there is a newer version of the program or library in the repository.
|
|
1170
|
-
*
|
|
1171
|
-
* On success, it will return a boolean, with false indicating that there is no new version, while true indicates that there is a new version available.
|
|
1172
|
-
*
|
|
1173
|
-
* In case of failure, it will return a string containing an error message. */
|
|
1174
|
-
checkUpgrade(filePath: string): boolean | string;
|
|
1175
|
-
/** Deletes a repository address from the `/etc/apt/sources.txt` file.
|
|
1176
|
-
*
|
|
1177
|
-
* On success, it will return an empty string. In case of failure, it will return a string with an error message. */
|
|
1178
|
-
delRepo(repositoryAddress: string): string;
|
|
1179
|
-
/** Installs a program or library from a remote repository listed in `/etc/apt/sources.txt`.
|
|
1180
|
-
*
|
|
1181
|
-
* If no path is specified, the program installs in `/lib` if it is a library or in `/bin` otherwise.
|
|
1182
|
-
*
|
|
1183
|
-
* On success, this method will return true. In case of failure, it will return a string containing an error message. */
|
|
1184
|
-
install(package: string, installPath?: string): true | string;
|
|
1185
|
-
/** Search specifically looks for a package in any of the repositories listed in `/etc/apt/sources.txt`.
|
|
1186
|
-
*
|
|
1187
|
-
* On success, it will return a string containing all packages that partially match the provided search value.
|
|
1188
|
-
*
|
|
1189
|
-
* On failure, it will return a string with various error messages. */
|
|
1190
|
-
search(package: string): string;
|
|
1191
|
-
/** Show displays all the packages available in a repository. The repository must be listed in the `/etc/apt/sources.txt` file.
|
|
1192
|
-
*
|
|
1193
|
-
* If it cannot find a repository, it will return various error messages.
|
|
1194
|
-
*
|
|
1195
|
-
* On success, it will return a string containing all packages and their descriptions, with each entry separated by a newline. */
|
|
1196
|
-
show(repositoryAddress: string): string;
|
|
1197
|
-
/** Update refreshes the list of available packages after adding a new repository in `/etc/apt/sources.txt`, or if the remote repository has updated its information in `/server/conf/repod.conf`.
|
|
1198
|
-
*
|
|
1199
|
-
* If the update is successful, an empty string will be returned. In case of failure, a string with an error message will be returned.
|
|
1200
|
-
*
|
|
1201
|
-
* If for some reason the `/etc/apt/sources.txt` is malformed this method will return false. */
|
|
1202
|
-
update(): string | false;
|
|
1203
|
-
}
|
|
1204
|
-
interface SmartAppliance {
|
|
1205
|
-
classID: "SmartAppliance";
|
|
1206
|
-
/** Returns a string with the appliance model ID. */
|
|
1207
|
-
model(): string;
|
|
1208
|
-
/** Overrides the power and temperature settings of the appliance.
|
|
1209
|
-
*
|
|
1210
|
-
* If successful, true is returned; otherwise, it returns a string detailing the error. */
|
|
1211
|
-
overrideSettings(power: number, temperature: number): true | string;
|
|
1212
|
-
/** Activates or deactivates the sound alarm indicating any appliance malfunction.
|
|
1213
|
-
*
|
|
1214
|
-
* If successful, true is returned; otherwise, a string containing error details is returned. */
|
|
1215
|
-
setAlarm(enable: boolean): true | string;
|
|
1216
|
-
}
|
|
1217
|
-
interface TrafficNet {
|
|
1218
|
-
classID: "TrafficNet";
|
|
1219
|
-
/** Accesses the traffic camera system, opening a window with controls to switch between different cameras.
|
|
1220
|
-
*
|
|
1221
|
-
* If the window opens successfully, this method returns true. In case of an error, it returns a string with details. */
|
|
1222
|
-
cameraLinkSystem(): true | string;
|
|
1223
|
-
/** Returns string which contains job and name of a NPC. If an error occurs, a string with details is returned. */
|
|
1224
|
-
getCredentialsInfo(): string;
|
|
1225
|
-
/** Performs a search for the specified license plate to locate the vehicle.
|
|
1226
|
-
*
|
|
1227
|
-
* If the vehicle is visible on any camera, the viewer will switch to the camera currently displaying it and return true.
|
|
1228
|
-
*
|
|
1229
|
-
* If the vehicle cannot be located or the license plate is incorrect, a string indicating the error is returned. */
|
|
1230
|
-
locateVehicle(licensePlate: string, password: string): true | string;
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
interface Math {
|
|
1234
|
-
/** Returns the value of pi to the precision of 6 */
|
|
1235
|
-
readonly PI: number;
|
|
1236
|
-
/** Returns the absolute value of number. */
|
|
1237
|
-
abs(value: number): number;
|
|
1238
|
-
/** Returns the inverse cosine (in radians) of a number. */
|
|
1239
|
-
acos(value: number): number;
|
|
1240
|
-
/** Returns the inverse sine (in radians) of a number. */
|
|
1241
|
-
asin(value: number): number;
|
|
1242
|
-
/** Returns the inverse tangent (in radians) of a number. */
|
|
1243
|
-
atan(y: number, x?: number | undefined): number;
|
|
1244
|
-
/** Returns number rounded up to the integer value of the provided number. */
|
|
1245
|
-
ceil(value: number): number;
|
|
1246
|
-
/** Returns number rounded down to the integer value of the provided number. */
|
|
1247
|
-
floor(value: number): number;
|
|
1248
|
-
/** Returns the cosine of a number in radians. */
|
|
1249
|
-
cos(value: number): number;
|
|
1250
|
-
/** Returns the sine of a number in radians. */
|
|
1251
|
-
sin(value: number): number;
|
|
1252
|
-
/** Returns the tangent of a number in radians. */
|
|
1253
|
-
tan(value: number): number;
|
|
1254
|
-
/** Returns the square root of a number. */
|
|
1255
|
-
sqrt(value: number): number;
|
|
1256
|
-
/** Returns 1 or -1 indicating the sign of the value passed or 0 if the value is 0 */
|
|
1257
|
-
sign(value: number): -1 | 0 | 1;
|
|
1258
|
-
/** Returns number rounded to the integer value of the provided number. */
|
|
1259
|
-
round(value: number, fixed?: number | undefined): number;
|
|
1260
|
-
/** Returns a random number between 0 and 1. Optionally a seed number can be provided. */
|
|
1261
|
-
random(seed?: number | undefined): number;
|
|
1262
|
-
/**
|
|
1263
|
-
* Returns the natural logarithm of a number.
|
|
1264
|
-
*
|
|
1265
|
-
* By default, the base is 10. Optionally the base can be changed.
|
|
1266
|
-
*/
|
|
1267
|
-
log(value: number, base?: number | undefined): number;
|
|
1268
|
-
/** Returns the smallest number of the given values */
|
|
1269
|
-
min(...values: number[]): number;
|
|
1270
|
-
/** Returns the largest number of the given values */
|
|
1271
|
-
max(...values: number[]): number;
|
|
1272
|
-
}
|
|
1273
|
-
declare var Math: Math;
|
|
1274
|
-
declare namespace GreyHack {
|
|
1275
|
-
interface CtfEvent {
|
|
1276
|
-
classID: "ctfEvent";
|
|
1277
|
-
/** Returns string with the name of the CTF event creator. */
|
|
1278
|
-
getCreatorName(): string;
|
|
1279
|
-
/** Returns string with the CTF event description. */
|
|
1280
|
-
getDescription(): string;
|
|
1281
|
-
/** Returns string with the mail content of the CTF event. */
|
|
1282
|
-
getMailContent(): string;
|
|
1283
|
-
/** Returns string with the CTF event template. */
|
|
1284
|
-
getTemplate(): string;
|
|
1285
|
-
/** Returns a boolean indicating if the CTF event got completed successfully */
|
|
1286
|
-
playerSuccess(): boolean;
|
|
1287
|
-
}
|
|
1288
|
-
interface MetaMail {
|
|
1289
|
-
classID: "MetaMail";
|
|
1290
|
-
/**
|
|
1291
|
-
* Delete the email corresponding to the provided email ID.
|
|
1292
|
-
*
|
|
1293
|
-
* Returns true if the email removal was successful. Otherwise, a string with an error message will be returned.
|
|
1294
|
-
*/
|
|
1295
|
-
delete(mailId: string): true | string;
|
|
1296
|
-
/**
|
|
1297
|
-
* Returns an array where each item is a string containing mail id, from, subject and a small preview of the content consisting of the first 125 characters.
|
|
1298
|
-
*
|
|
1299
|
-
* If there is any issue a string will be returned with details.
|
|
1300
|
-
*/
|
|
1301
|
-
fetch(): string[] | string;
|
|
1302
|
-
/**
|
|
1303
|
-
* Returns a string containing the content of a mail related to the provided mail id.
|
|
1304
|
-
*
|
|
1305
|
-
* The mail id argument can be obtained with fetch. In case the mail cannot be found this method will return `Mail not found`.
|
|
1306
|
-
*/
|
|
1307
|
-
read(mailId: string): string;
|
|
1308
|
-
/**
|
|
1309
|
-
* Send a new mail to the provided email address.
|
|
1310
|
-
*
|
|
1311
|
-
* Keep in mind that the subject can not exceed 128 characters and the message size should not exceed 2500 characters.
|
|
1312
|
-
*
|
|
1313
|
-
* @returns true indicating that the mail has been sent correctly, or a string with an error
|
|
1314
|
-
*/
|
|
1315
|
-
send(emailAddress: string, subject: string, message: string): string | true;
|
|
1316
|
-
}
|
|
1317
|
-
interface NetSession {
|
|
1318
|
-
classID: "NetSession";
|
|
1319
|
-
/**
|
|
1320
|
-
* Returns the {@link MetaLib} associated with the remote service.
|
|
1321
|
-
*
|
|
1322
|
-
* For example if the {@link Metaxploit} method netUse was used on a ssh port it will return the MetaLib related to the ssh service. In case the port was zero is will return a MetaLib related to the kernel router.
|
|
1323
|
-
*/
|
|
1324
|
-
dumpLib(): MetaLib;
|
|
1325
|
-
/**
|
|
1326
|
-
* Initiates a DDoS attack targeting the computer associated with the currently active NetSession object.
|
|
1327
|
-
*
|
|
1328
|
-
* To successfully force a reboot, there must be at least 4 concurrent floodConnection calls for every 1 unit of net speed on the target computer. Keep in mind that these calls need to come from different IPs. So for example PackS would require 12 active floodConnection calls. If the threshold is met, the target computer will be forced to reboot, and the terminal will output: `remote connection interrupted`.
|
|
1329
|
-
*
|
|
1330
|
-
* This method always returns null and only prints a message upon a successful attack.
|
|
1331
|
-
*/
|
|
1332
|
-
floodConnection(): null;
|
|
1333
|
-
/** Returns the number of devices using this router as a gateway. If you obtained your NetSession from a computer, it will fetch and return the value from its gateway router. */
|
|
1334
|
-
getNumConnGateway(): number;
|
|
1335
|
-
/** Returns the number of ports forwarded by this router. If you obtained your NetSession from a computer, it will fetch and return the value from its gateway router. */
|
|
1336
1718
|
getNumPortforward(): number;
|
|
1337
1719
|
/** Returns the number of user accounts on the system. */
|
|
1338
1720
|
getNumUsers(): number;
|
|
@@ -1341,6 +1723,67 @@ declare namespace GreyHack {
|
|
|
1341
1723
|
/** Return a boolean indicating if there is an active root user on the system */
|
|
1342
1724
|
isRootActiveUser(): boolean;
|
|
1343
1725
|
}
|
|
1726
|
+
}
|
|
1727
|
+
type PropertyKey = number | string | symbol;
|
|
1728
|
+
interface Object {
|
|
1729
|
+
/** Returns a string representation of an object. */
|
|
1730
|
+
toString(): string;
|
|
1731
|
+
}
|
|
1732
|
+
interface ObjectConstructor {
|
|
1733
|
+
new (value?: any): Object;
|
|
1734
|
+
readonly prototype: Object;
|
|
1735
|
+
/** Determines whether an object has a property with the specified name. */
|
|
1736
|
+
hasOwn<T extends PropertyKey, U = object>(o: U, key: T): o is (T extends keyof U ? U : U & {
|
|
1737
|
+
[K in T]: unknown;
|
|
1738
|
+
});
|
|
1739
|
+
/**
|
|
1740
|
+
* Returns a key of the object that has a value equal to the given value
|
|
1741
|
+
* @example
|
|
1742
|
+
* const myObject = { test: 123, other: 222 };
|
|
1743
|
+
* const key = Object.indexOf(myObject, 222);
|
|
1744
|
+
* print(key); // Prints "other"
|
|
1745
|
+
*/
|
|
1746
|
+
indexOf<T extends Record<any, any>>(o: T, value: T[keyof T]): keyof T | null;
|
|
1747
|
+
/** Copy the properties of the source to the target */
|
|
1748
|
+
assign<T extends {}, U>(target: T, source: U): T & U;
|
|
1749
|
+
assign<T extends {}, U, V>(target: T, source: U, source2: V): T & U & V;
|
|
1750
|
+
assign<T extends {}, U, V, W>(target: T, source: U, source2: V, source3: W): T & U & V & W;
|
|
1751
|
+
assign(target: object, ...sources: any[]): any;
|
|
1752
|
+
/** Returns the number of items inside the object */
|
|
1753
|
+
size<T extends Record<any, any>>(o: T): number;
|
|
1754
|
+
/** Returns an array of keys of the object */
|
|
1755
|
+
keys<T extends Record<any, any>>(o: T): (Exclude<keyof T, symbol>)[];
|
|
1756
|
+
/** Returns an array of values of the object */
|
|
1757
|
+
values<T extends Record<any, any>>(o: T): (T[keyof T])[];
|
|
1758
|
+
/** Returns sum of all values inside the given object. Any non-numeric values will be considered a zero. */
|
|
1759
|
+
sum(o: Record<any, any>): number;
|
|
1760
|
+
/** Shuffles all **values** in the object. This operation will mutate the map. */
|
|
1761
|
+
shuffle(o: Record<any, any>): null;
|
|
1762
|
+
/**
|
|
1763
|
+
* Replaces each value of the object matching `oldValue` with `newValue`.
|
|
1764
|
+
*
|
|
1765
|
+
* This method will mutate the object
|
|
1766
|
+
* @example
|
|
1767
|
+
* const myObject = { status: "online" };
|
|
1768
|
+
* Object.replace(myObject, "online", "offline");
|
|
1769
|
+
* print(myObject); // Prints { "status": "offline" };
|
|
1770
|
+
*/
|
|
1771
|
+
replace<T extends Record<any, any>>(o: T, oldValue: T[keyof T], newValue: T[keyof T], maxCount?: number): T;
|
|
1772
|
+
/**
|
|
1773
|
+
* Removes a key-value pair from the object. This method mutates the object.
|
|
1774
|
+
*
|
|
1775
|
+
* @returns a boolean indicating success
|
|
1776
|
+
*/
|
|
1777
|
+
remove<T extends Record<any, any>>(o: T, key: keyof T): boolean;
|
|
1778
|
+
/**
|
|
1779
|
+
* Removes the first item of the object and returns it's key
|
|
1780
|
+
*
|
|
1781
|
+
* This method mutates the object.
|
|
1782
|
+
*/
|
|
1783
|
+
shift<T extends Record<any, any>>(o: T): keyof T | null;
|
|
1784
|
+
}
|
|
1785
|
+
declare var Object: ObjectConstructor;
|
|
1786
|
+
declare namespace GreyHack {
|
|
1344
1787
|
interface Port {
|
|
1345
1788
|
classID: "port";
|
|
1346
1789
|
/** Port number used by this port */
|
|
@@ -1350,119 +1793,7 @@ declare namespace GreyHack {
|
|
|
1350
1793
|
/** Returns a string containing the local IP address of the computer to which the port is pointing. */
|
|
1351
1794
|
getLanIp(): string;
|
|
1352
1795
|
}
|
|
1353
|
-
interface Router {
|
|
1354
|
-
classID: "router";
|
|
1355
|
-
/** BSSID value of the router */
|
|
1356
|
-
bssidName: string;
|
|
1357
|
-
/** ESSID value of the router */
|
|
1358
|
-
essidName: string;
|
|
1359
|
-
/** Version of the `kernel_router.so` library */
|
|
1360
|
-
kernelVersion: string;
|
|
1361
|
-
/** Local IP address of the router. */
|
|
1362
|
-
localIp: string;
|
|
1363
|
-
/** Public IP address of the router. */
|
|
1364
|
-
publicIp: string;
|
|
1365
|
-
/**
|
|
1366
|
-
* Returns an array where each item is an open port related to the device of the provided LAN IP address. The device needs to be within the network of the router.
|
|
1367
|
-
*
|
|
1368
|
-
* In case of failure, this method will return null or a string with details. In case an empty ip is provided this method will throw a runtime exception. */
|
|
1369
|
-
devicePorts(ip: string): Port[] | string | null;
|
|
1370
|
-
/**
|
|
1371
|
-
* Returns an array where each item is a string representing a LAN IP address.
|
|
1372
|
-
*
|
|
1373
|
-
* All devices are within the network of the router and can be reached by using the ping method. Some of the devices might be behind a firewall.
|
|
1374
|
-
*/
|
|
1375
|
-
devicesLanIp(): string[];
|
|
1376
|
-
/** Returns an array where each item is a string containing a firewall rule. */
|
|
1377
|
-
firewallRules(): string[];
|
|
1378
|
-
/** Returns a {@link Port} that is behind the port number provided. In case the port does not exist null gets returned. */
|
|
1379
|
-
pingPort(portNumber: number): Port | null;
|
|
1380
|
-
/**
|
|
1381
|
-
* Returns a string with information about the provided port, including details about the running service and its version.
|
|
1382
|
-
*
|
|
1383
|
-
* For example, the output could be `http 1.0.0`. If the operation fails, null will be returned.
|
|
1384
|
-
*/
|
|
1385
|
-
portInfo(port: Port): string | null;
|
|
1386
|
-
/** Returns an array where each item is a {@link Port} used inside the router. */
|
|
1387
|
-
usedPorts(): Port[];
|
|
1388
|
-
}
|
|
1389
|
-
interface FtpShell {
|
|
1390
|
-
classID: "ftpShell";
|
|
1391
|
-
/** Returns a computer related to the shell. */
|
|
1392
|
-
hostComputer: FtpComputer;
|
|
1393
|
-
/**
|
|
1394
|
-
* Send a file to the computer related to the provided shell.
|
|
1395
|
-
*
|
|
1396
|
-
* You require permission to read the file on the computer from which you are uploading and write permissions in the folder of the computer you are trying to upload to.
|
|
1397
|
-
*
|
|
1398
|
-
* Via the optional isUpload parameter you can define the direction.
|
|
1399
|
-
*
|
|
1400
|
-
* In case of failure, this method will return a string with the cause. Otherwise, true will be returned. In case the string for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution. Utilizing this method in an SSH encryption process will trigger an error, halting further script execution.
|
|
1401
|
-
*/
|
|
1402
|
-
scp: Shell["scp"];
|
|
1403
|
-
}
|
|
1404
|
-
interface Shell {
|
|
1405
|
-
classID: "shell";
|
|
1406
|
-
/** Returns a computer related to the shell. */
|
|
1407
|
-
hostComputer: Computer;
|
|
1408
|
-
/**
|
|
1409
|
-
* Compiles a plain code file provided in the arguments to a binary.
|
|
1410
|
-
*
|
|
1411
|
-
* On success, the new binary will be available under the provided build folder. The binary name will be the same as the source file just without the file extension. Optionally, an allowImport flag can be set which enables the use of import_code on the binary. All provided paths must be absolute. Returns an empty string on success. On failure, it will return a string containing details about the reason for failure.
|
|
1412
|
-
*
|
|
1413
|
-
* In case any provided values deviate from the defined signature a runtime exception will be thrown.
|
|
1414
|
-
*/
|
|
1415
|
-
build(sourcePath: string, binaryPath: string, allowImport?: boolean): string;
|
|
1416
|
-
/**
|
|
1417
|
-
* Returns a shell if the connection attempt to the provided IP was successful.
|
|
1418
|
-
*
|
|
1419
|
-
* This method can only connect to ports running an SSH or FTP service. SSH services usually run on port 22 and FTP services usually on port 21. Keep in mind to pass the right service value depending on which service is going to be used. By default, it will use SSH as the service. Please note that connecting will leave a log entry.
|
|
1420
|
-
*
|
|
1421
|
-
* In case of failure, a string is returned containing details. If this method is run in an SSH encryption process, or if the computer is not connected to the internet, a runtime exception will be thrown.
|
|
1422
|
-
*/
|
|
1423
|
-
connectService(ip: string, port: number, user: string, password: string, service?: "ssh" | "ftp"): Shell | FtpShell | string | null;
|
|
1424
|
-
/**
|
|
1425
|
-
* Launches the binary located at the provided path.
|
|
1426
|
-
*
|
|
1427
|
-
* Optionally, parameters can be passed. Returns a boolean indicating the success of the launch. In some cases, a string will be returned containing an error message.
|
|
1428
|
-
*
|
|
1429
|
-
* If you need to share variables between a launched script and the current process, consider using {@link getCustomObject}.
|
|
1430
|
-
*
|
|
1431
|
-
* Note that launching a script is not asynchronous, meaning that the current script will pause its execution until the launched script finishes. If any provided values deviate from the method signature or it is used within an SSH encryption process, a runtime exception will be thrown.
|
|
1432
|
-
*
|
|
1433
|
-
* There is a cooldown of 2 seconds between launches to prevent abuse. If you attempt to launch a script during this cooldown period, the method will return false.
|
|
1434
|
-
*/
|
|
1435
|
-
launch(program: string, params?: string): string | boolean;
|
|
1436
|
-
/**
|
|
1437
|
-
* Pings an IP address.
|
|
1438
|
-
*
|
|
1439
|
-
* Return a boolean indicating if the remote address could be reached. Firewalls do not block ping requests. Passing an invalid ip will cause the method to return a string with an error message.
|
|
1440
|
-
*/
|
|
1441
|
-
ping(ip: string): string | boolean;
|
|
1442
|
-
/**
|
|
1443
|
-
* Send a file to the computer related to the provided shell.
|
|
1444
|
-
*
|
|
1445
|
-
* You require permission to read the file on the computer from which you are uploading and write permissions in the folder of the computer you are trying to upload to.
|
|
1446
|
-
*
|
|
1447
|
-
* Via the optional isUpload parameter you can define the direction.
|
|
1448
|
-
*
|
|
1449
|
-
* In case of failure, this method will return a string with the cause. Otherwise, true will be returned. In case the string for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution. Utilizing this method in an SSH encryption process will trigger an error, halting further script execution.
|
|
1450
|
-
*/
|
|
1451
|
-
scp(file: string, folder: string, remoteShell: Shell, isUpload?: boolean): boolean | string;
|
|
1452
|
-
/**
|
|
1453
|
-
* Launches an active terminal.
|
|
1454
|
-
*
|
|
1455
|
-
* The terminal's color will change, displaying the IP of the connected shell. Script execution will be stopped upon starting a new terminal, unless this is called from another script that was executed via {@link Shell.launch}. In that case, you will enter the shell after closing your root-level script within that terminal window.
|
|
1456
|
-
*
|
|
1457
|
-
* Using this method within an SSH encryption process will cause an error to be thrown, preventing further script execution.
|
|
1458
|
-
*/
|
|
1459
|
-
startTerminal(): never;
|
|
1460
|
-
}
|
|
1461
1796
|
}
|
|
1462
|
-
declare const console: {
|
|
1463
|
-
readonly log: typeof GreyHack.print;
|
|
1464
|
-
readonly clear: typeof GreyHack.clearScreen;
|
|
1465
|
-
};
|
|
1466
1797
|
interface RegExp {
|
|
1467
1798
|
}
|
|
1468
1799
|
interface CallableFunction {
|
|
@@ -1545,194 +1876,46 @@ interface String {
|
|
|
1545
1876
|
/** Returns a number which is parsed from the string. In case the string is not numeric it will return a zero. */
|
|
1546
1877
|
val(): number;
|
|
1547
1878
|
/** Returns an array where each item is a string representing all available characters in the string. Could be compared to using {@link String.split|split} but with empty separator. */
|
|
1548
|
-
values(): string[];
|
|
1549
|
-
/** Removes the leading white space characters from a string. */
|
|
1550
|
-
trimStart(): string;
|
|
1551
|
-
/** Removes the trailing white space characters from a string. */
|
|
1552
|
-
trimEnd(): string;
|
|
1553
|
-
/**
|
|
1554
|
-
* Returns true if searchString appears as a substring of this string, at one or more positions that are greater than or equal to position; otherwise, returns false.
|
|
1555
|
-
*
|
|
1556
|
-
* @param searchString search string
|
|
1557
|
-
* @param position If position is undefined, 0 is assumed, so as to search all of the string.
|
|
1558
|
-
*/
|
|
1559
|
-
includes(searchString: string, position?: number): boolean;
|
|
1560
|
-
/** Returns true if this string starts with the searchString. Otherwise returns false. */
|
|
1561
|
-
startsWith(searchString: string, position?: number): boolean;
|
|
1562
|
-
/** Returns true if this string ends with the searchString. Otherwise returns false. */
|
|
1563
|
-
endsWith(searchString: string, endPosition?: number): boolean;
|
|
1564
|
-
/**
|
|
1565
|
-
* Returns a string value that is made from count copies appended together.
|
|
1566
|
-
*
|
|
1567
|
-
* If count is 0, the empty string is returned.
|
|
1568
|
-
*/
|
|
1569
|
-
repeat(count: number): string;
|
|
1570
|
-
/**
|
|
1571
|
-
* Returns a section of a string.
|
|
1572
|
-
* @param start The index to the beginning of the specified portion of string.
|
|
1573
|
-
* @param end The index to the end of the specified portion of string. The substring includes the characters up to, but not including, the character indicated by end. If this value is not specified, the substring continues to the end of string.
|
|
1574
|
-
*/
|
|
1575
|
-
slice(start?: number, end?: number): string;
|
|
1576
|
-
/** Returns a string representation of a string. */
|
|
1577
|
-
toString(): string;
|
|
1578
|
-
readonly [index: number]: string;
|
|
1579
|
-
}
|
|
1580
|
-
interface Number {
|
|
1581
|
-
/** Returns a string representation of a number. */
|
|
1582
|
-
toString(): string;
|
|
1583
|
-
/**
|
|
1584
|
-
* Returns a string representing a number in fixed-point notation.
|
|
1585
|
-
* @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
|
|
1586
|
-
*/
|
|
1587
|
-
toFixed(fractionDigits?: number): string;
|
|
1588
|
-
}
|
|
1589
|
-
type PropertyKey = number | string | symbol;
|
|
1590
|
-
interface Object {
|
|
1591
|
-
/** Returns a string representation of an object. */
|
|
1592
|
-
toString(): string;
|
|
1593
|
-
}
|
|
1594
|
-
interface ObjectConstructor {
|
|
1595
|
-
new (value?: any): Object;
|
|
1596
|
-
readonly prototype: Object;
|
|
1597
|
-
/** Determines whether an object has a property with the specified name. */
|
|
1598
|
-
hasOwn<T extends PropertyKey, U = object>(o: U, key: T): o is (T extends keyof U ? U : U & {
|
|
1599
|
-
[K in T]: unknown;
|
|
1600
|
-
});
|
|
1601
|
-
/**
|
|
1602
|
-
* Returns a key of the object that has a value equal to the given value
|
|
1603
|
-
* @example
|
|
1604
|
-
* const myObject = { test: 123, other: 222 };
|
|
1605
|
-
* const key = Object.indexOf(myObject, 222);
|
|
1606
|
-
* print(key); // Prints "other"
|
|
1607
|
-
*/
|
|
1608
|
-
indexOf<T extends Record<any, any>>(o: T, value: T[keyof T]): keyof T | null;
|
|
1609
|
-
/** Copy the properties of the source to the target */
|
|
1610
|
-
assign<T extends {}, U>(target: T, source: U): T & U;
|
|
1611
|
-
assign<T extends {}, U, V>(target: T, source: U, source2: V): T & U & V;
|
|
1612
|
-
assign<T extends {}, U, V, W>(target: T, source: U, source2: V, source3: W): T & U & V & W;
|
|
1613
|
-
assign(target: object, ...sources: any[]): any;
|
|
1614
|
-
/** Returns the number of items inside the object */
|
|
1615
|
-
size<T extends Record<any, any>>(o: T): number;
|
|
1616
|
-
/** Returns an array of keys of the object */
|
|
1617
|
-
keys<T extends Record<any, any>>(o: T): (Exclude<keyof T, symbol>)[];
|
|
1618
|
-
/** Returns an array of values of the object */
|
|
1619
|
-
values<T extends Record<any, any>>(o: T): (T[keyof T])[];
|
|
1620
|
-
/** Returns sum of all values inside the given object. Any non-numeric values will be considered a zero. */
|
|
1621
|
-
sum(o: Record<any, any>): number;
|
|
1622
|
-
/** Shuffles all **values** in the object. This operation will mutate the map. */
|
|
1623
|
-
shuffle(o: Record<any, any>): null;
|
|
1624
|
-
/**
|
|
1625
|
-
* Replaces each value of the object matching `oldValue` with `newValue`.
|
|
1626
|
-
*
|
|
1627
|
-
* This method will mutate the object
|
|
1628
|
-
* @example
|
|
1629
|
-
* const myObject = { status: "online" };
|
|
1630
|
-
* Object.replace(myObject, "online", "offline");
|
|
1631
|
-
* print(myObject); // Prints { "status": "offline" };
|
|
1632
|
-
*/
|
|
1633
|
-
replace<T extends Record<any, any>>(o: T, oldValue: T[keyof T], newValue: T[keyof T], maxCount?: number): T;
|
|
1634
|
-
/**
|
|
1635
|
-
* Removes a key-value pair from the object. This method mutates the object.
|
|
1636
|
-
*
|
|
1637
|
-
* @returns a boolean indicating success
|
|
1638
|
-
*/
|
|
1639
|
-
remove<T extends Record<any, any>>(o: T, key: keyof T): boolean;
|
|
1640
|
-
/**
|
|
1641
|
-
* Removes the first item of the object and returns it's key
|
|
1642
|
-
*
|
|
1643
|
-
* This method mutates the object.
|
|
1644
|
-
*/
|
|
1645
|
-
shift<T extends Record<any, any>>(o: T): keyof T | null;
|
|
1646
|
-
}
|
|
1647
|
-
interface Array<T> {
|
|
1648
|
-
readonly length: number;
|
|
1649
|
-
/** Returns a boolean indicating if the provided index exists in the array */
|
|
1650
|
-
hasIndex(index: number): boolean;
|
|
1651
|
-
/** Returns the index of the first occurrence of a value in an array, or null if it is not present. */
|
|
1652
|
-
indexOf(value: T, offset?: number): number | null;
|
|
1653
|
-
/** Returns an array containing the indexes of the array */
|
|
1654
|
-
indexes(): number[];
|
|
1655
|
-
/** Inserts a value into the array at the provided index. This method mutates the array and returns a reference to the same array. */
|
|
1656
|
-
insert(index: number, value: T): T[];
|
|
1657
|
-
/**
|
|
1658
|
-
* Returns a concatenated string containing all stringified values inside the list. These values will be separated via the provided separator.
|
|
1659
|
-
*
|
|
1660
|
-
* In case the list exceeds `16777215L` items or the delimiter exceeds 128 characters, this method will throw an error, interrupting further script execution.
|
|
1661
|
-
*/
|
|
1662
|
-
join(delimiter: string): string;
|
|
1663
|
-
/** Removes the first element from an array and returns it. If the array is empty, null is returned. */
|
|
1664
|
-
shift(): T | null;
|
|
1665
|
-
/** Inserts new elements at the start of an array, and returns the new length of the array. */
|
|
1666
|
-
unshift(...items: T[]): number;
|
|
1667
|
-
/** Removes the last element from an array and returns it. If the array is empty, null is returned. */
|
|
1668
|
-
pop(): T | null;
|
|
1669
|
-
/** Appends new elements to the end of an array, and returns the new length of the array. */
|
|
1670
|
-
push(...items: T[]): number;
|
|
1671
|
-
/**
|
|
1672
|
-
* Removes an item from the list with the provided index. Due to the removal the list will get mutated.
|
|
1673
|
-
*/
|
|
1674
|
-
remove(index: number): null;
|
|
1879
|
+
values(): string[];
|
|
1880
|
+
/** Removes the leading white space characters from a string. */
|
|
1881
|
+
trimStart(): string;
|
|
1882
|
+
/** Removes the trailing white space characters from a string. */
|
|
1883
|
+
trimEnd(): string;
|
|
1675
1884
|
/**
|
|
1676
|
-
*
|
|
1885
|
+
* Returns true if searchString appears as a substring of this string, at one or more positions that are greater than or equal to position; otherwise, returns false.
|
|
1677
1886
|
*
|
|
1678
|
-
*
|
|
1887
|
+
* @param searchString search string
|
|
1888
|
+
* @param position If position is undefined, 0 is assumed, so as to search all of the string.
|
|
1679
1889
|
*/
|
|
1680
|
-
|
|
1681
|
-
/**
|
|
1682
|
-
|
|
1683
|
-
/**
|
|
1684
|
-
|
|
1890
|
+
includes(searchString: string, position?: number): boolean;
|
|
1891
|
+
/** Returns true if this string starts with the searchString. Otherwise returns false. */
|
|
1892
|
+
startsWith(searchString: string, position?: number): boolean;
|
|
1893
|
+
/** Returns true if this string ends with the searchString. Otherwise returns false. */
|
|
1894
|
+
endsWith(searchString: string, endPosition?: number): boolean;
|
|
1685
1895
|
/**
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
1688
|
-
* This operation mutates the original array. Optionally, a key can be provided, which is used if the items are objects or arrays. Finally, this method returns the updated array.
|
|
1689
|
-
* @example
|
|
1690
|
-
* const myArray = [{ key: 123 }, { key: 5 }, { key: 17 }];
|
|
1691
|
-
* myArray.sort("key");
|
|
1896
|
+
* Returns a string value that is made from count copies appended together.
|
|
1692
1897
|
*
|
|
1693
|
-
*
|
|
1694
|
-
* numbers.sort()
|
|
1898
|
+
* If count is 0, the empty string is returned.
|
|
1695
1899
|
*/
|
|
1696
|
-
|
|
1697
|
-
/** Returns a sum of all values inside the array. Any non-numeric values will be considered a zero. */
|
|
1698
|
-
sum(): number;
|
|
1699
|
-
values(): T[];
|
|
1700
|
-
/** Determines whether an array includes a certain element, returning true or false as appropriate. */
|
|
1701
|
-
includes(searchElement: T, fromIndex?: number): boolean;
|
|
1900
|
+
repeat(count: number): string;
|
|
1702
1901
|
/**
|
|
1703
|
-
*
|
|
1704
|
-
* @param
|
|
1902
|
+
* Returns a section of a string.
|
|
1903
|
+
* @param start The index to the beginning of the specified portion of string.
|
|
1904
|
+
* @param end The index to the end of the specified portion of string. The substring includes the characters up to, but not including, the character indicated by end. If this value is not specified, the substring continues to the end of string.
|
|
1705
1905
|
*/
|
|
1706
|
-
|
|
1707
|
-
/**
|
|
1708
|
-
map<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[];
|
|
1709
|
-
/** Returns the elements of an array that meet the condition specified in a callback function. */
|
|
1710
|
-
filter(predicate: (value: T, index: number, array: T[]) => unknown): T[];
|
|
1711
|
-
/** Returns the value of the first element in the array where predicate is true, and null otherwise. */
|
|
1712
|
-
find(predicate: (value: T, index: number, array: T[]) => unknown): T | null;
|
|
1713
|
-
/** Determines whether the specified callback function returns true for any element of an array. */
|
|
1714
|
-
some(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
|
|
1715
|
-
/** Determines whether all the members of an array satisfy the specified test. */
|
|
1716
|
-
every(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
|
|
1717
|
-
/**
|
|
1718
|
-
* Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array.
|
|
1719
|
-
*
|
|
1720
|
-
* For example, -2 refers to the second to last element of the array.
|
|
1721
|
-
* @param start The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.
|
|
1722
|
-
* @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.
|
|
1723
|
-
* */
|
|
1724
|
-
slice(start?: number, end?: number): T[];
|
|
1725
|
-
/**
|
|
1726
|
-
* Removes elements from an array and returns the deleted elements.
|
|
1727
|
-
*
|
|
1728
|
-
* For example, -2 refers to the second to last element of the array.
|
|
1729
|
-
* @param start The zero-based location in the array from which to start removing elements
|
|
1730
|
-
* @param end The number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array.
|
|
1731
|
-
* */
|
|
1732
|
-
splice(start: number, deleteCount?: number): T[];
|
|
1733
|
-
/** Returns a string representation of an array. */
|
|
1906
|
+
slice(start?: number, end?: number): string;
|
|
1907
|
+
/** Returns a string representation of a string. */
|
|
1734
1908
|
toString(): string;
|
|
1735
|
-
[
|
|
1909
|
+
readonly [index: number]: string;
|
|
1910
|
+
}
|
|
1911
|
+
interface Number {
|
|
1912
|
+
/** Returns a string representation of a number. */
|
|
1913
|
+
toString(): string;
|
|
1914
|
+
/**
|
|
1915
|
+
* Returns a string representing a number in fixed-point notation.
|
|
1916
|
+
* @param fractionDigits Number of digits after the decimal point.
|
|
1917
|
+
*/
|
|
1918
|
+
toFixed(fractionDigits?: number): string;
|
|
1736
1919
|
}
|
|
1737
1920
|
interface Function {
|
|
1738
1921
|
/** Returns a string representation of a function. */
|
|
@@ -1753,13 +1936,189 @@ declare var Boolean: {
|
|
|
1753
1936
|
<T>(value?: T): boolean;
|
|
1754
1937
|
readonly prototype: Boolean;
|
|
1755
1938
|
};
|
|
1756
|
-
declare var Array: {
|
|
1757
|
-
readonly prototype: Array<any>;
|
|
1758
|
-
};
|
|
1759
1939
|
declare var Function: {
|
|
1760
1940
|
readonly prototype: Function;
|
|
1761
1941
|
};
|
|
1762
|
-
declare
|
|
1942
|
+
declare namespace GreyHack {
|
|
1943
|
+
interface Router {
|
|
1944
|
+
classID: "router";
|
|
1945
|
+
/** BSSID value of the router */
|
|
1946
|
+
bssidName: string;
|
|
1947
|
+
/** ESSID value of the router */
|
|
1948
|
+
essidName: string;
|
|
1949
|
+
/** Version of the `kernel_router.so` library */
|
|
1950
|
+
kernelVersion: string;
|
|
1951
|
+
/** Local IP address of the router. */
|
|
1952
|
+
localIp: string;
|
|
1953
|
+
/** Public IP address of the router. */
|
|
1954
|
+
publicIp: string;
|
|
1955
|
+
/**
|
|
1956
|
+
* Returns an array where each item is an open port related to the device of the provided LAN IP address. The device needs to be within the network of the router.
|
|
1957
|
+
*
|
|
1958
|
+
* In case of failure, this method will return null or a string with details. In case an empty ip is provided this method will throw a runtime exception.
|
|
1959
|
+
*/
|
|
1960
|
+
devicePorts(ip: string): Port[] | string | null;
|
|
1961
|
+
/**
|
|
1962
|
+
* Returns an array where each item is a string representing a LAN IP address.
|
|
1963
|
+
*
|
|
1964
|
+
* All devices are within the network of the router and can be reached by using the ping method. Some of the devices might be behind a firewall.
|
|
1965
|
+
*/
|
|
1966
|
+
devicesLanIp(): string[];
|
|
1967
|
+
/** Returns an array where each item is a string containing a firewall rule. */
|
|
1968
|
+
firewallRules(): string[];
|
|
1969
|
+
/** Returns a {@link Port} that is behind the port number provided. In case the port does not exist null gets returned. */
|
|
1970
|
+
pingPort(portNumber: number): Port | null;
|
|
1971
|
+
/**
|
|
1972
|
+
* Returns a string with information about the provided port, including details about the running service and its version.
|
|
1973
|
+
*
|
|
1974
|
+
* For example, the output could be `http 1.0.0`. If the operation fails, null will be returned.
|
|
1975
|
+
*/
|
|
1976
|
+
portInfo(port: Port): string | null;
|
|
1977
|
+
/** Returns an array where each item is a {@link Port} used inside the router. */
|
|
1978
|
+
usedPorts(): Port[];
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
declare namespace GreyHack {
|
|
1982
|
+
interface Service {
|
|
1983
|
+
classID: "service";
|
|
1984
|
+
/**
|
|
1985
|
+
* Installs the necessary files for the correct functioning of the service and starts it.
|
|
1986
|
+
*
|
|
1987
|
+
* If the installation is completed successfully, it returns true. In case of an error, it returns a string with details.
|
|
1988
|
+
*/
|
|
1989
|
+
installService(): true | string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Starts the service and opens its associated port on the local machine.
|
|
1992
|
+
*
|
|
1993
|
+
* The service requires a port forwarded to the router to be accessible from the outside.
|
|
1994
|
+
*
|
|
1995
|
+
* If the service starts correctly, it returns true. In case of an error, it returns a string with details.
|
|
1996
|
+
*/
|
|
1997
|
+
startService(): true | string;
|
|
1998
|
+
/**
|
|
1999
|
+
* Stops the service and closes its associated port on the local machine.
|
|
2000
|
+
*
|
|
2001
|
+
* If the service is stopped successfully, it returns true.
|
|
2002
|
+
*
|
|
2003
|
+
* If an error occurs during the process, it returns a string with details. In some cases, the returned value might be false, indicating that the service removal failed.
|
|
2004
|
+
*/
|
|
2005
|
+
stopService(): boolean | string;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
declare namespace GreyHack {
|
|
2009
|
+
interface FtpShell {
|
|
2010
|
+
classID: "ftpShell";
|
|
2011
|
+
/** Returns a computer related to the shell. */
|
|
2012
|
+
hostComputer: FtpComputer;
|
|
2013
|
+
/**
|
|
2014
|
+
* Send a file to the computer related to the provided shell.
|
|
2015
|
+
*
|
|
2016
|
+
* You require permission to read the file on the computer from which you are uploading and write permissions in the folder of the computer you are trying to upload to.
|
|
2017
|
+
*
|
|
2018
|
+
* Via the optional isUpload parameter you can define the direction.
|
|
2019
|
+
*
|
|
2020
|
+
* In case of failure, this method will return a string with the cause. Otherwise, true will be returned. In case the string for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution. Utilizing this method in an SSH encryption process will trigger an error, halting further script execution.
|
|
2021
|
+
*/
|
|
2022
|
+
scp: Shell["scp"];
|
|
2023
|
+
}
|
|
2024
|
+
interface Shell {
|
|
2025
|
+
classID: "shell";
|
|
2026
|
+
/** Returns a computer related to the shell. */
|
|
2027
|
+
hostComputer: Computer;
|
|
2028
|
+
/**
|
|
2029
|
+
* Compiles a plain code file provided in the arguments to a binary.
|
|
2030
|
+
*
|
|
2031
|
+
* On success, the new binary will be available under the provided build folder. The binary name will be the same as the source file just without the file extension. Optionally, an allowImport flag can be set which enables the use of import_code on the binary. All provided paths must be absolute. Returns an empty string on success. On failure, it will return a string containing details about the reason for failure.
|
|
2032
|
+
*
|
|
2033
|
+
* In case any provided values deviate from the defined signature a runtime exception will be thrown.
|
|
2034
|
+
*/
|
|
2035
|
+
build(sourcePath: string, binaryPath: string, allowImport?: boolean): string;
|
|
2036
|
+
/**
|
|
2037
|
+
* Returns a shell if the connection attempt to the provided IP was successful.
|
|
2038
|
+
*
|
|
2039
|
+
* This method can only connect to ports running an SSH or FTP service. SSH services usually run on port 22 and FTP services usually on port 21. Keep in mind to pass the right service value depending on which service is going to be used. By default, it will use SSH as the service. Please note that connecting will leave a log entry.
|
|
2040
|
+
*
|
|
2041
|
+
* In case of failure, a string is returned containing details. If this method is run in an SSH encryption process, or if the computer is not connected to the internet, a runtime exception will be thrown.
|
|
2042
|
+
*/
|
|
2043
|
+
connectService(ip: string, port: number, user: string, password: string, service?: "ssh" | "ftp"): Shell | FtpShell | string | null;
|
|
2044
|
+
/**
|
|
2045
|
+
* Launches the binary located at the provided path.
|
|
2046
|
+
*
|
|
2047
|
+
* Optionally, parameters can be passed. Returns a boolean indicating the success of the launch. In some cases, a string will be returned containing an error message.
|
|
2048
|
+
*
|
|
2049
|
+
* If you need to share variables between a launched script and the current process, consider using {@link getCustomObject}.
|
|
2050
|
+
*
|
|
2051
|
+
* Note that launching a script is not asynchronous, meaning that the current script will pause its execution until the launched script finishes. If any provided values deviate from the method signature or it is used within an SSH encryption process, a runtime exception will be thrown.
|
|
2052
|
+
*
|
|
2053
|
+
* There is a cooldown of 2 seconds between launches to prevent abuse. If you attempt to launch a script during this cooldown period, the method will return false.
|
|
2054
|
+
*/
|
|
2055
|
+
launch(program: string, params?: string): string | boolean;
|
|
2056
|
+
/**
|
|
2057
|
+
* Pings an IP address.
|
|
2058
|
+
*
|
|
2059
|
+
* Return a boolean indicating if the remote address could be reached. Firewalls do not block ping requests. Passing an invalid ip will cause the method to return a string with an error message.
|
|
2060
|
+
*/
|
|
2061
|
+
ping(ip: string): string | boolean;
|
|
2062
|
+
/**
|
|
2063
|
+
* Send a file to the computer related to the provided shell.
|
|
2064
|
+
*
|
|
2065
|
+
* You require permission to read the file on the computer from which you are uploading and write permissions in the folder of the computer you are trying to upload to.
|
|
2066
|
+
*
|
|
2067
|
+
* Via the optional isUpload parameter you can define the direction.
|
|
2068
|
+
*
|
|
2069
|
+
* In case of failure, this method will return a string with the cause. Otherwise, true will be returned. In case the string for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution. Utilizing this method in an SSH encryption process will trigger an error, halting further script execution.
|
|
2070
|
+
*/
|
|
2071
|
+
scp(file: string, folder: string, remoteShell: Shell, isUpload?: boolean): true | string;
|
|
2072
|
+
/**
|
|
2073
|
+
* Launches an active terminal.
|
|
2074
|
+
*
|
|
2075
|
+
* The terminal's color will change, displaying the IP of the connected shell. Script execution will be stopped upon starting a new terminal, unless this is called from another script that was executed via {@link Shell.launch}. In that case, you will enter the shell after closing your root-level script within that terminal window.
|
|
2076
|
+
*
|
|
2077
|
+
* Using this method within an SSH encryption process will cause an error to be thrown, preventing further script execution.
|
|
2078
|
+
*/
|
|
2079
|
+
startTerminal(): never;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
declare namespace GreyHack {
|
|
2083
|
+
interface SmartAppliance {
|
|
2084
|
+
classID: "SmartAppliance";
|
|
2085
|
+
/** Returns a string with the appliance model ID. */
|
|
2086
|
+
model(): string;
|
|
2087
|
+
/**
|
|
2088
|
+
* Overrides the power and temperature settings of the appliance.
|
|
2089
|
+
*
|
|
2090
|
+
* If successful, true is returned; otherwise, it returns a string detailing the error.
|
|
2091
|
+
*/
|
|
2092
|
+
overrideSettings(power: number, temperature: number): true | string;
|
|
2093
|
+
/**
|
|
2094
|
+
* Activates or deactivates the sound alarm indicating any appliance malfunction.
|
|
2095
|
+
*
|
|
2096
|
+
* If successful, true is returned; otherwise, a string containing error details is returned.
|
|
2097
|
+
*/
|
|
2098
|
+
setAlarm(enable: boolean): true | string;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
declare namespace GreyHack {
|
|
2102
|
+
interface TrafficNet {
|
|
2103
|
+
classID: "TrafficNet";
|
|
2104
|
+
/**
|
|
2105
|
+
* Accesses the traffic camera system, opening a window with controls to switch between different cameras.
|
|
2106
|
+
*
|
|
2107
|
+
* If the window opens successfully, this method returns true. In case of an error, it returns a string with details.
|
|
2108
|
+
*/
|
|
2109
|
+
cameraLinkSystem(): true | string;
|
|
2110
|
+
/** Returns string which contains job and name of a NPC. If an error occurs, a string with details is returned. */
|
|
2111
|
+
getCredentialsInfo(): string;
|
|
2112
|
+
/**
|
|
2113
|
+
* Performs a search for the specified license plate to locate the vehicle.
|
|
2114
|
+
*
|
|
2115
|
+
* If the vehicle is visible on any camera, the viewer will switch to the camera currently displaying it and return true.
|
|
2116
|
+
*
|
|
2117
|
+
* If the vehicle cannot be located or the license plate is incorrect, a string indicating the error is returned.
|
|
2118
|
+
*/
|
|
2119
|
+
locateVehicle(licensePlate: string, password: string): true | string;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
1763
2122
|
type netDeviceNumbers = 0 | 1 | 2 | 3 | 4;
|
|
1764
2123
|
type wlanDevice = `wlan${netDeviceNumbers}`;
|
|
1765
2124
|
type ethDevice = `eth${netDeviceNumbers}`;
|