@grey-ts/types 2.0.1 → 2.2.0
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 +172 -71
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -233,7 +233,7 @@ declare namespace GreyHack {
|
|
|
233
233
|
*
|
|
234
234
|
* If the provided username is empty, an error will be thrown, preventing any further script execution.
|
|
235
235
|
*/
|
|
236
|
-
changePassword(username: string, password: string):
|
|
236
|
+
changePassword(username: string, password: string): true | string;
|
|
237
237
|
/**
|
|
238
238
|
* Closes a program associated with the provided PID.
|
|
239
239
|
*
|
|
@@ -457,7 +457,7 @@ declare namespace GreyHack {
|
|
|
457
457
|
*
|
|
458
458
|
* 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
459
|
*/
|
|
460
|
-
copy(destFolder?: string, newName?: string): string |
|
|
460
|
+
copy(destFolder?: string, newName?: string): string | true | null;
|
|
461
461
|
/**
|
|
462
462
|
* Delete the current file.
|
|
463
463
|
*
|
|
@@ -466,7 +466,8 @@ declare namespace GreyHack {
|
|
|
466
466
|
* Note that deleting a file will leave a log entry.
|
|
467
467
|
*/
|
|
468
468
|
delete(): string;
|
|
469
|
-
/**
|
|
469
|
+
/**
|
|
470
|
+
* Returns a boolean indicating if the user who launched the script has the requested permissions.
|
|
470
471
|
*
|
|
471
472
|
* In case the file gets deleted, this method will return null instead.
|
|
472
473
|
*/
|
|
@@ -484,7 +485,7 @@ declare namespace GreyHack {
|
|
|
484
485
|
*
|
|
485
486
|
* 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
487
|
*/
|
|
487
|
-
move(destFolder: string, newName?: string): string |
|
|
488
|
+
move(destFolder: string, newName?: string): string | true | null;
|
|
488
489
|
/**
|
|
489
490
|
* 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
491
|
* @param symLinkOriginalPath return the original path of the linked file instead
|
|
@@ -598,7 +599,8 @@ declare namespace GreyHack {
|
|
|
598
599
|
* Using this method in a SSH encryption process will cause an error to be thrown preventing further script execution.
|
|
599
600
|
*/
|
|
600
601
|
function getCustomObject<T = object>(): T & Record<string, any>;
|
|
601
|
-
/**
|
|
602
|
+
/**
|
|
603
|
+
* Returns by default the {@link Router router} to which the executing computer is connected to.
|
|
602
604
|
*
|
|
603
605
|
* Optionally an IP address can be provided. In case of failure `null` is returned.
|
|
604
606
|
*
|
|
@@ -620,7 +622,8 @@ declare namespace GreyHack {
|
|
|
620
622
|
*/
|
|
621
623
|
function getShell(): Shell;
|
|
622
624
|
function getShell(username?: string, password?: string): Shell | null;
|
|
623
|
-
/**
|
|
625
|
+
/**
|
|
626
|
+
* Returns the switch on the local network whose IP address matches
|
|
624
627
|
* @example
|
|
625
628
|
* const switch = getSwitch("192.168.1.4");
|
|
626
629
|
* if (switch) print("This device is a switch!");
|
|
@@ -753,7 +756,8 @@ declare namespace GreyHack {
|
|
|
753
756
|
function yield(): null;
|
|
754
757
|
/** Returns the type of the object */
|
|
755
758
|
function getType(value: any): string;
|
|
756
|
-
/**
|
|
759
|
+
/**
|
|
760
|
+
* Checks if the given object is of a specific type
|
|
757
761
|
* @example
|
|
758
762
|
* const metax = includeLib("/lib/metaxploit.so");
|
|
759
763
|
* if (isType(metax, "MetaxploitLib")) {
|
|
@@ -923,13 +927,15 @@ declare namespace GreyHack {
|
|
|
923
927
|
* If the launch was successful, true will be returned. In case of failure, a string with details will be returned.
|
|
924
928
|
*/
|
|
925
929
|
rshellClient(ip: string, port: number, processName?: string): true | string;
|
|
926
|
-
/**
|
|
930
|
+
/**
|
|
931
|
+
* This method returns an array of {@link Shell} objects that have been reverse shell connected to this computer.
|
|
927
932
|
*
|
|
928
933
|
* To manage the connections received, the rshell service must be installed on the machine that receives the victims' connections.
|
|
929
934
|
*
|
|
930
935
|
* In case of failure a string will be returned with details. */
|
|
931
936
|
rshellServer(): Shell[] | string;
|
|
932
|
-
/**
|
|
937
|
+
/**
|
|
938
|
+
* Returns an array where each item is a string representing a memory area which has vulnerabilities related to the provided library.
|
|
933
939
|
*
|
|
934
940
|
* These memory areas can be used to make further scans via {@link Metaxploit.scanAddress}.
|
|
935
941
|
*
|
|
@@ -1018,37 +1024,48 @@ declare namespace GreyHack {
|
|
|
1018
1024
|
}
|
|
1019
1025
|
interface DebugLibrary {
|
|
1020
1026
|
classID: "debugLibrary";
|
|
1021
|
-
/**
|
|
1027
|
+
/**
|
|
1028
|
+
* Applies a patch containing corrected code to the specified text file at the provided path.
|
|
1022
1029
|
*
|
|
1023
|
-
* Returns a string with the result of the operation.
|
|
1030
|
+
* Returns a string with the result of the operation.
|
|
1031
|
+
*/
|
|
1024
1032
|
applyPatch(path: string): string;
|
|
1025
|
-
/**
|
|
1033
|
+
/**
|
|
1034
|
+
* Returns a list containing a single partial computer object if zero-day vulnerabilities are detected within the specified memory zone.
|
|
1026
1035
|
*
|
|
1027
1036
|
* If a file path is provided, a partial file object associated with this path will also be included in the array.
|
|
1028
1037
|
*
|
|
1029
1038
|
* Additionally, if this file is a library, its corresponding metaLib object is added to the returned array.
|
|
1030
1039
|
*
|
|
1031
|
-
* In case of an error, a string with details is returned.
|
|
1040
|
+
* In case of an error, a string with details is returned.
|
|
1041
|
+
*/
|
|
1032
1042
|
payload(memZone: string): string | [Partial<Computer>];
|
|
1033
1043
|
payload(memZone: string, filePath: string): string | [Partial<Computer>, Partial<File>] | [Partial<Computer>, Partial<File>, MetaLib];
|
|
1034
|
-
/**
|
|
1044
|
+
/**
|
|
1045
|
+
* Scans the library in debug mode to identify potential code errors that may lead to vulnerabilities.
|
|
1035
1046
|
*
|
|
1036
|
-
* If issues are detected, the relevant code snippets are printed. In case of an error, a string containing the error message is returned.
|
|
1047
|
+
* If issues are detected, the relevant code snippets are printed. In case of an error, a string containing the error message is returned.
|
|
1048
|
+
*/
|
|
1037
1049
|
scan(): string;
|
|
1038
|
-
/**
|
|
1050
|
+
/**
|
|
1051
|
+
* Conducts automated tests on the specified lines of code.
|
|
1039
1052
|
*
|
|
1040
1053
|
* 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
1054
|
*
|
|
1042
|
-
* In case of failure, this function returns a string with an error message.
|
|
1055
|
+
* In case of failure, this function returns a string with an error message.
|
|
1056
|
+
*/
|
|
1043
1057
|
unitTesting(errorLines: number[]): string;
|
|
1044
1058
|
}
|
|
1045
1059
|
interface Crypto {
|
|
1046
1060
|
classID: "cryptoLib";
|
|
1047
|
-
/**
|
|
1061
|
+
/**
|
|
1062
|
+
* Returns a string containing the password based on the file which was generated via aireplay.
|
|
1048
1063
|
*
|
|
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.
|
|
1064
|
+
* In case of failure, it will return null instead. If the provided path is empty, an error will be thrown, interrupting the script execution.
|
|
1065
|
+
*/
|
|
1050
1066
|
aircrack(path: string): string | null;
|
|
1051
|
-
/**
|
|
1067
|
+
/**
|
|
1068
|
+
* Used to inject frames on wireless interfaces.
|
|
1052
1069
|
*
|
|
1053
1070
|
* 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
1071
|
*
|
|
@@ -1058,15 +1075,19 @@ declare namespace GreyHack {
|
|
|
1058
1075
|
*
|
|
1059
1076
|
* 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.
|
|
1060
1077
|
*
|
|
1061
|
-
* 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.
|
|
1078
|
+
* 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.
|
|
1079
|
+
*/
|
|
1062
1080
|
aireplay(bssid: string, essid: string, maxAcks?: number): string | null;
|
|
1063
|
-
/**
|
|
1081
|
+
/**
|
|
1082
|
+
* Enables or disables the monitor mode of a network device.
|
|
1064
1083
|
*
|
|
1065
1084
|
* Monitor mode can only be enabled on Wifi cards.
|
|
1066
1085
|
*
|
|
1067
|
-
* 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.
|
|
1086
|
+
* 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.
|
|
1087
|
+
*/
|
|
1068
1088
|
airmon(option: "start" | "stop", device: netDevice): boolean | string;
|
|
1069
|
-
/**
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns a decrypted password via the provided password MD5 hash.
|
|
1070
1091
|
*
|
|
1071
1092
|
* 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.
|
|
1072
1093
|
*
|
|
@@ -1092,28 +1113,37 @@ declare namespace GreyHack {
|
|
|
1092
1113
|
* }
|
|
1093
1114
|
*/
|
|
1094
1115
|
decipher(hash: string): string | null;
|
|
1095
|
-
/**
|
|
1116
|
+
/**
|
|
1117
|
+
* Decrypts the specified file using the provided key.
|
|
1096
1118
|
*
|
|
1097
|
-
* On success, the method returns true. If decryption fails, a descriptive error message is returned as a string.
|
|
1119
|
+
* On success, the method returns true. If decryption fails, a descriptive error message is returned as a string.
|
|
1120
|
+
*/
|
|
1098
1121
|
decrypt(filePath: string, password: string): true | string;
|
|
1099
|
-
/**
|
|
1122
|
+
/**
|
|
1123
|
+
* Encrypts the specified file using the provided key.
|
|
1100
1124
|
*
|
|
1101
|
-
* On success, the method returns true. If encryption fails, a descriptive error message is returned as a string.
|
|
1125
|
+
* On success, the method returns true. If encryption fails, a descriptive error message is returned as a string.
|
|
1126
|
+
*/
|
|
1102
1127
|
encrypt(filePath: string, password: string): true | string;
|
|
1103
|
-
/**
|
|
1128
|
+
/**
|
|
1129
|
+
* Checks whether the specified file is encrypted.
|
|
1104
1130
|
*
|
|
1105
|
-
* Returns true if the file is encrypted, or
|
|
1131
|
+
* 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.
|
|
1132
|
+
*/
|
|
1106
1133
|
isEncrypted(filePath: string): boolean | string;
|
|
1107
|
-
/**
|
|
1134
|
+
/**
|
|
1135
|
+
* Returns an array of the existing users on the computer where the SMTP service is running.
|
|
1108
1136
|
*
|
|
1109
1137
|
* If these users also have an email account registered on the SMTP server, it will be indicated in the array.
|
|
1110
1138
|
*
|
|
1111
|
-
* SMTP services are usually running on port 25. In case of failure, this method will return a string containing the cause.
|
|
1139
|
+
* SMTP services are usually running on port 25. In case of failure, this method will return a string containing the cause.
|
|
1140
|
+
*/
|
|
1112
1141
|
smtpUserList(ip: string, port: number): string[] | string;
|
|
1113
1142
|
}
|
|
1114
1143
|
interface BlockChain {
|
|
1115
1144
|
classID: "blockchainLib";
|
|
1116
|
-
/**
|
|
1145
|
+
/**
|
|
1146
|
+
* Returns a number representing the total amount of mined coins.
|
|
1117
1147
|
*
|
|
1118
1148
|
* In case of an error, it will return a string with the details.
|
|
1119
1149
|
* @example
|
|
@@ -1128,105 +1158,138 @@ declare namespace GreyHack {
|
|
|
1128
1158
|
* print(`There are ${mined} coins mined for this coin`);
|
|
1129
1159
|
*/
|
|
1130
1160
|
amountMined(coinName: string): number | string;
|
|
1131
|
-
/**
|
|
1161
|
+
/**
|
|
1162
|
+
* Returns a number representing the current unit value of the cryptocurrency.
|
|
1132
1163
|
*
|
|
1133
|
-
* In case of an error, a string with the error details will be returned.
|
|
1164
|
+
* In case of an error, a string with the error details will be returned.
|
|
1165
|
+
*/
|
|
1134
1166
|
coinPrice(coinName: string): number | string;
|
|
1135
|
-
/**
|
|
1167
|
+
/**
|
|
1168
|
+
* Creates a wallet and returns a wallet object on success, which can be used to manage cryptocurrencies.
|
|
1136
1169
|
*
|
|
1137
|
-
* In case of an error, it will return a string with the details.
|
|
1170
|
+
* In case of an error, it will return a string with the details.
|
|
1171
|
+
*/
|
|
1138
1172
|
createWallet(user: string, password: string): Wallet | string;
|
|
1139
|
-
/**
|
|
1173
|
+
/**
|
|
1174
|
+
* Removes a cryptocurrency from the world. The credentials used in the creation of the cryptocurrency are required.
|
|
1140
1175
|
*
|
|
1141
1176
|
* On success, it will return a true.
|
|
1142
1177
|
*
|
|
1143
|
-
* On failure, it will return a string containing details.
|
|
1178
|
+
* On failure, it will return a string containing details.
|
|
1179
|
+
*/
|
|
1144
1180
|
deleteCoin(coinName: string, user: string, password: string): true | string;
|
|
1145
|
-
/**
|
|
1181
|
+
/**
|
|
1182
|
+
* Returns a coin object used to manage the currency.
|
|
1146
1183
|
*
|
|
1147
|
-
* In case of an error, it will return a string with the details.
|
|
1184
|
+
* In case of an error, it will return a string with the details.
|
|
1185
|
+
*/
|
|
1148
1186
|
getCoin(coinName: string, user: string, password: string): Coin | string;
|
|
1149
|
-
/**
|
|
1187
|
+
/**
|
|
1188
|
+
* Returns a string with the name of the coin owned by the player.
|
|
1150
1189
|
*
|
|
1151
|
-
* In case of an error, it returns a string with details.
|
|
1190
|
+
* In case of an error, it returns a string with details.
|
|
1191
|
+
*/
|
|
1152
1192
|
getCoinName(user: string, password: string): string;
|
|
1153
1193
|
/** Returns a wallet object on success. In case of an error, it will return a string indicating the reason. */
|
|
1154
1194
|
loginWallet(user: string, password: string): Wallet | string;
|
|
1155
|
-
/**
|
|
1195
|
+
/**
|
|
1196
|
+
* Returns an object with the latest changes in the value of a specific cryptocurrency.
|
|
1156
1197
|
*
|
|
1157
1198
|
* 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
1199
|
*
|
|
1159
|
-
* If no coin exists with this name, the method will return null.
|
|
1200
|
+
* If no coin exists with this name, the method will return null.
|
|
1201
|
+
*/
|
|
1160
1202
|
showHistory(coinName: string): Record<number, [number, string]> | string | null;
|
|
1161
1203
|
}
|
|
1162
1204
|
interface AptClient {
|
|
1163
1205
|
classID: "aptClientLib";
|
|
1164
|
-
/**
|
|
1206
|
+
/**
|
|
1207
|
+
* Inserts a repository address into the `/etc/apt/sources.txt` file.
|
|
1165
1208
|
*
|
|
1166
1209
|
* On success, it will return an empty string. In case of failure, it will return a string with an error message.
|
|
1167
1210
|
*/
|
|
1168
1211
|
addRepo(repositoryAddress: string, port?: number): string;
|
|
1169
|
-
/**
|
|
1212
|
+
/**
|
|
1213
|
+
* Checks if there is a newer version of the program or library in the repository.
|
|
1170
1214
|
*
|
|
1171
1215
|
* 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
1216
|
*
|
|
1173
|
-
* In case of failure, it will return a string containing an error message.
|
|
1217
|
+
* In case of failure, it will return a string containing an error message.
|
|
1218
|
+
*/
|
|
1174
1219
|
checkUpgrade(filePath: string): boolean | string;
|
|
1175
|
-
/**
|
|
1220
|
+
/**
|
|
1221
|
+
* Deletes a repository address from the `/etc/apt/sources.txt` file.
|
|
1176
1222
|
*
|
|
1177
|
-
* On success, it will return an empty string. In case of failure, it will return a string with an error message.
|
|
1223
|
+
* On success, it will return an empty string. In case of failure, it will return a string with an error message.
|
|
1224
|
+
*/
|
|
1178
1225
|
delRepo(repositoryAddress: string): string;
|
|
1179
|
-
/**
|
|
1226
|
+
/**
|
|
1227
|
+
* Installs a program or library from a remote repository listed in `/etc/apt/sources.txt`.
|
|
1180
1228
|
*
|
|
1181
1229
|
* If no path is specified, the program installs in `/lib` if it is a library or in `/bin` otherwise.
|
|
1182
1230
|
*
|
|
1183
|
-
* On success, this method will return true. In case of failure, it will return a string containing an error message.
|
|
1231
|
+
* On success, this method will return true. In case of failure, it will return a string containing an error message.
|
|
1232
|
+
*/
|
|
1184
1233
|
install(package: string, installPath?: string): true | string;
|
|
1185
|
-
/**
|
|
1234
|
+
/**
|
|
1235
|
+
* Search specifically looks for a package in any of the repositories listed in `/etc/apt/sources.txt`.
|
|
1186
1236
|
*
|
|
1187
1237
|
* On success, it will return a string containing all packages that partially match the provided search value.
|
|
1188
1238
|
*
|
|
1189
|
-
* On failure, it will return a string with various error messages.
|
|
1239
|
+
* On failure, it will return a string with various error messages.
|
|
1240
|
+
*/
|
|
1190
1241
|
search(package: string): string;
|
|
1191
|
-
/**
|
|
1242
|
+
/**
|
|
1243
|
+
* Show displays all the packages available in a repository. The repository must be listed in the `/etc/apt/sources.txt` file.
|
|
1192
1244
|
*
|
|
1193
1245
|
* If it cannot find a repository, it will return various error messages.
|
|
1194
1246
|
*
|
|
1195
|
-
* On success, it will return a string containing all packages and their descriptions, with each entry separated by a newline.
|
|
1247
|
+
* On success, it will return a string containing all packages and their descriptions, with each entry separated by a newline.
|
|
1248
|
+
*/
|
|
1196
1249
|
show(repositoryAddress: string): string;
|
|
1197
|
-
/**
|
|
1250
|
+
/**
|
|
1251
|
+
* 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
1252
|
*
|
|
1199
1253
|
* 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
1254
|
*
|
|
1201
|
-
* If for some reason the `/etc/apt/sources.txt` is malformed this method will return false.
|
|
1255
|
+
* If for some reason the `/etc/apt/sources.txt` is malformed this method will return false.
|
|
1256
|
+
*/
|
|
1202
1257
|
update(): string | false;
|
|
1203
1258
|
}
|
|
1204
1259
|
interface SmartAppliance {
|
|
1205
1260
|
classID: "SmartAppliance";
|
|
1206
1261
|
/** Returns a string with the appliance model ID. */
|
|
1207
1262
|
model(): string;
|
|
1208
|
-
/**
|
|
1263
|
+
/**
|
|
1264
|
+
* Overrides the power and temperature settings of the appliance.
|
|
1209
1265
|
*
|
|
1210
|
-
* If successful, true is returned; otherwise, it returns a string detailing the error.
|
|
1266
|
+
* If successful, true is returned; otherwise, it returns a string detailing the error.
|
|
1267
|
+
*/
|
|
1211
1268
|
overrideSettings(power: number, temperature: number): true | string;
|
|
1212
|
-
/**
|
|
1269
|
+
/**
|
|
1270
|
+
* Activates or deactivates the sound alarm indicating any appliance malfunction.
|
|
1213
1271
|
*
|
|
1214
|
-
* If successful, true is returned; otherwise, a string containing error details is returned.
|
|
1272
|
+
* If successful, true is returned; otherwise, a string containing error details is returned.
|
|
1273
|
+
*/
|
|
1215
1274
|
setAlarm(enable: boolean): true | string;
|
|
1216
1275
|
}
|
|
1217
1276
|
interface TrafficNet {
|
|
1218
1277
|
classID: "TrafficNet";
|
|
1219
|
-
/**
|
|
1278
|
+
/**
|
|
1279
|
+
* Accesses the traffic camera system, opening a window with controls to switch between different cameras.
|
|
1220
1280
|
*
|
|
1221
|
-
* If the window opens successfully, this method returns true. In case of an error, it returns a string with details.
|
|
1281
|
+
* If the window opens successfully, this method returns true. In case of an error, it returns a string with details.
|
|
1282
|
+
*/
|
|
1222
1283
|
cameraLinkSystem(): true | string;
|
|
1223
1284
|
/** Returns string which contains job and name of a NPC. If an error occurs, a string with details is returned. */
|
|
1224
1285
|
getCredentialsInfo(): string;
|
|
1225
|
-
/**
|
|
1286
|
+
/**
|
|
1287
|
+
* Performs a search for the specified license plate to locate the vehicle.
|
|
1226
1288
|
*
|
|
1227
1289
|
* If the vehicle is visible on any camera, the viewer will switch to the camera currently displaying it and return true.
|
|
1228
1290
|
*
|
|
1229
|
-
* If the vehicle cannot be located or the license plate is incorrect, a string indicating the error is returned.
|
|
1291
|
+
* If the vehicle cannot be located or the license plate is incorrect, a string indicating the error is returned.
|
|
1292
|
+
*/
|
|
1230
1293
|
locateVehicle(licensePlate: string, password: string): true | string;
|
|
1231
1294
|
}
|
|
1232
1295
|
}
|
|
@@ -1365,7 +1428,8 @@ declare namespace GreyHack {
|
|
|
1365
1428
|
/**
|
|
1366
1429
|
* 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
1430
|
*
|
|
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.
|
|
1431
|
+
* 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.
|
|
1432
|
+
*/
|
|
1369
1433
|
devicePorts(ip: string): Port[] | string | null;
|
|
1370
1434
|
/**
|
|
1371
1435
|
* Returns an array where each item is a string representing a LAN IP address.
|
|
@@ -1448,7 +1512,7 @@ declare namespace GreyHack {
|
|
|
1448
1512
|
*
|
|
1449
1513
|
* 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
1514
|
*/
|
|
1451
|
-
scp(file: string, folder: string, remoteShell: Shell, isUpload?: boolean):
|
|
1515
|
+
scp(file: string, folder: string, remoteShell: Shell, isUpload?: boolean): true | string;
|
|
1452
1516
|
/**
|
|
1453
1517
|
* Launches an active terminal.
|
|
1454
1518
|
*
|
|
@@ -1540,12 +1604,23 @@ interface String {
|
|
|
1540
1604
|
* In case the string is not numeric it will return the original string.
|
|
1541
1605
|
*/
|
|
1542
1606
|
toInt(): string | number;
|
|
1543
|
-
/** Removes the leading and trailing white space
|
|
1607
|
+
/** Removes the leading and trailing white space characters from a string. */
|
|
1544
1608
|
trim(): string;
|
|
1545
1609
|
/** Returns a number which is parsed from the string. In case the string is not numeric it will return a zero. */
|
|
1546
1610
|
val(): number;
|
|
1547
1611
|
/** 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
1612
|
values(): string[];
|
|
1613
|
+
/** Removes the leading white space characters from a string. */
|
|
1614
|
+
trimStart(): string;
|
|
1615
|
+
/** Removes the trailing white space characters from a string. */
|
|
1616
|
+
trimEnd(): string;
|
|
1617
|
+
/**
|
|
1618
|
+
* 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.
|
|
1619
|
+
*
|
|
1620
|
+
* @param searchString search string
|
|
1621
|
+
* @param position If position is undefined, 0 is assumed, so as to search all of the string.
|
|
1622
|
+
*/
|
|
1623
|
+
includes(searchString: string, position?: number): boolean;
|
|
1549
1624
|
/** Returns true if this string starts with the searchString. Otherwise returns false. */
|
|
1550
1625
|
startsWith(searchString: string, position?: number): boolean;
|
|
1551
1626
|
/** Returns true if this string ends with the searchString. Otherwise returns false. */
|
|
@@ -1569,6 +1644,11 @@ interface String {
|
|
|
1569
1644
|
interface Number {
|
|
1570
1645
|
/** Returns a string representation of a number. */
|
|
1571
1646
|
toString(): string;
|
|
1647
|
+
/**
|
|
1648
|
+
* Returns a string representing a number in fixed-point notation.
|
|
1649
|
+
* @param fractionDigits Number of digits after the decimal point.
|
|
1650
|
+
*/
|
|
1651
|
+
toFixed(fractionDigits?: number): string;
|
|
1572
1652
|
}
|
|
1573
1653
|
type PropertyKey = number | string | symbol;
|
|
1574
1654
|
interface Object {
|
|
@@ -1681,7 +1761,19 @@ interface Array<T> {
|
|
|
1681
1761
|
/** Returns a sum of all values inside the array. Any non-numeric values will be considered a zero. */
|
|
1682
1762
|
sum(): number;
|
|
1683
1763
|
values(): T[];
|
|
1684
|
-
/**
|
|
1764
|
+
/**
|
|
1765
|
+
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
|
|
1766
|
+
* @param value value to fill array section with
|
|
1767
|
+
* @param start index to start filling the array at. If start is negative, it is treated as
|
|
1768
|
+
* length+start where length is the length of the array.
|
|
1769
|
+
* @param end index to stop filling the array at. If end is negative, it is treated as
|
|
1770
|
+
* length+end.
|
|
1771
|
+
*/
|
|
1772
|
+
fill(value: T, start?: number, end?: number): this;
|
|
1773
|
+
/** Determines whether an array includes a certain element, returning true or false as appropriate. */
|
|
1774
|
+
includes(searchElement: T, fromIndex?: number): boolean;
|
|
1775
|
+
/**
|
|
1776
|
+
* Combines two or more arrays. This method returns a new array without modifying any existing arrays.
|
|
1685
1777
|
* @param items Additional arrays and/or items to add to the end of the array.
|
|
1686
1778
|
*/
|
|
1687
1779
|
concat(...items: (T | T[])[]): T[];
|
|
@@ -1695,13 +1787,22 @@ interface Array<T> {
|
|
|
1695
1787
|
some(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
|
|
1696
1788
|
/** Determines whether all the members of an array satisfy the specified test. */
|
|
1697
1789
|
every(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
|
|
1698
|
-
/**
|
|
1790
|
+
/**
|
|
1791
|
+
* 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.
|
|
1699
1792
|
*
|
|
1700
1793
|
* For example, -2 refers to the second to last element of the array.
|
|
1701
1794
|
* @param start The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.
|
|
1702
1795
|
* @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.
|
|
1703
1796
|
* */
|
|
1704
1797
|
slice(start?: number, end?: number): T[];
|
|
1798
|
+
/**
|
|
1799
|
+
* Removes elements from an array and returns the deleted elements.
|
|
1800
|
+
*
|
|
1801
|
+
* For example, -2 refers to the second to last element of the array.
|
|
1802
|
+
* @param start The zero-based location in the array from which to start removing elements
|
|
1803
|
+
* @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.
|
|
1804
|
+
* */
|
|
1805
|
+
splice(start: number, deleteCount?: number): T[];
|
|
1705
1806
|
/** Returns a string representation of an array. */
|
|
1706
1807
|
toString(): string;
|
|
1707
1808
|
[n: number]: T;
|