frida 16.7.14 → 16.7.15
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/README.md +1 -10
- package/build/BSDmakefile +6 -0
- package/build/Makefile +10 -0
- package/build/src/frida.d.ts +364 -0
- package/build/src/frida.js +962 -0
- package/build/src/frida_binding.d.ts +938 -0
- package/meson.build +34 -67
- package/package.json +30 -20
- package/scripts/fetch-abi-bits.py +15 -65
- package/scripts/install.js +5 -4
- package/src/addon.def +3 -0
- package/src/addon.symbols +2 -1
- package/src/addon.version +4 -0
- package/src/frida_bindgen/__init__.py +0 -0
- package/src/frida_bindgen/__main__.py +4 -0
- package/src/frida_bindgen/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/frida_bindgen/__pycache__/__main__.cpython-312.pyc +0 -0
- package/src/frida_bindgen/__pycache__/cli.cpython-312.pyc +0 -0
- package/src/frida_bindgen/__pycache__/codegen.cpython-312.pyc +0 -0
- package/src/frida_bindgen/__pycache__/customization.cpython-312.pyc +0 -0
- package/src/frida_bindgen/__pycache__/loader.cpython-312.pyc +0 -0
- package/src/frida_bindgen/__pycache__/model.cpython-312.pyc +0 -0
- package/src/frida_bindgen/assets/codegen_helpers.c +1970 -0
- package/src/frida_bindgen/assets/codegen_helpers.ts +100 -0
- package/src/frida_bindgen/assets/codegen_prototypes.h +78 -0
- package/src/frida_bindgen/assets/codegen_types.h +57 -0
- package/src/frida_bindgen/assets/customization_facade.exports +13 -0
- package/src/frida_bindgen/assets/customization_facade.ts +157 -0
- package/src/frida_bindgen/assets/customization_helpers.imports +2 -0
- package/src/frida_bindgen/assets/customization_helpers.ts +396 -0
- package/src/frida_bindgen/cli.py +96 -0
- package/src/frida_bindgen/codegen.py +2233 -0
- package/src/frida_bindgen/customization.py +924 -0
- package/src/frida_bindgen/loader.py +60 -0
- package/src/frida_bindgen/model.py +1357 -0
- package/src/meson.build +92 -27
- package/{lib/build.py → src/tsc.py} +12 -12
- package/src/win_delay_load_hook.c +56 -0
- package/subprojects/frida-core.wrap +1 -1
- package/test/data/index.ts +2 -2
- package/test/device.ts +1 -2
- package/test/device_manager.ts +1 -2
- package/test/labrat.ts +2 -2
- package/test/script.ts +12 -12
- package/test/session.ts +3 -3
- package/tsconfig.json +6 -11
- package/dist/application.d.ts +0 -81
- package/dist/application.js +0 -2
- package/dist/authentication.d.ts +0 -3
- package/dist/authentication.js +0 -2
- package/dist/bus.d.ts +0 -16
- package/dist/bus.js +0 -23
- package/dist/cancellable.d.ts +0 -15
- package/dist/cancellable.js +0 -41
- package/dist/child.d.ts +0 -16
- package/dist/child.js +0 -9
- package/dist/crash.d.ts +0 -10
- package/dist/crash.js +0 -2
- package/dist/device.d.ts +0 -156
- package/dist/device.js +0 -188
- package/dist/device_manager.d.ts +0 -25
- package/dist/device_manager.js +0 -42
- package/dist/endpoint_parameters.d.ts +0 -26
- package/dist/endpoint_parameters.js +0 -24
- package/dist/icon.d.ts +0 -14
- package/dist/icon.js +0 -2
- package/dist/index.d.ts +0 -161
- package/dist/index.js +0 -170
- package/dist/iostream.d.ts +0 -13
- package/dist/iostream.js +0 -73
- package/dist/native.d.ts +0 -1
- package/dist/native.js +0 -11
- package/dist/portal_membership.d.ts +0 -6
- package/dist/portal_membership.js +0 -12
- package/dist/portal_service.d.ts +0 -48
- package/dist/portal_service.js +0 -52
- package/dist/process.d.ts +0 -47
- package/dist/process.js +0 -2
- package/dist/relay.d.ts +0 -22
- package/dist/relay.js +0 -32
- package/dist/script.d.ts +0 -70
- package/dist/script.js +0 -266
- package/dist/service.d.ts +0 -16
- package/dist/service.js +0 -26
- package/dist/session.d.ts +0 -45
- package/dist/session.js +0 -73
- package/dist/signals.d.ts +0 -20
- package/dist/signals.js +0 -40
- package/dist/socket_address.d.ts +0 -25
- package/dist/socket_address.js +0 -2
- package/dist/spawn.d.ts +0 -4
- package/dist/spawn.js +0 -2
- package/dist/system_parameters.d.ts +0 -84
- package/dist/system_parameters.js +0 -2
- package/lib/application.ts +0 -98
- package/lib/authentication.ts +0 -3
- package/lib/bus.ts +0 -30
- package/lib/cancellable.ts +0 -48
- package/lib/child.ts +0 -15
- package/lib/crash.ts +0 -11
- package/lib/device.ts +0 -331
- package/lib/device_manager.ts +0 -69
- package/lib/endpoint_parameters.ts +0 -56
- package/lib/icon.ts +0 -15
- package/lib/index.ts +0 -316
- package/lib/iostream.ts +0 -78
- package/lib/meson.build +0 -53
- package/lib/native.ts +0 -9
- package/lib/portal_membership.ts +0 -10
- package/lib/portal_service.ts +0 -105
- package/lib/process.ts +0 -57
- package/lib/relay.ts +0 -44
- package/lib/script.ts +0 -361
- package/lib/service.ts +0 -34
- package/lib/session.ts +0 -113
- package/lib/signals.ts +0 -45
- package/lib/socket_address.ts +0 -35
- package/lib/spawn.ts +0 -4
- package/lib/system_parameters.ts +0 -103
- package/meson.options +0 -11
- package/src/addon.cc +0 -78
- package/src/application.cc +0 -148
- package/src/application.h +0 -31
- package/src/authentication.cc +0 -174
- package/src/authentication.h +0 -24
- package/src/bus.cc +0 -167
- package/src/bus.h +0 -33
- package/src/cancellable.cc +0 -117
- package/src/cancellable.h +0 -31
- package/src/child.cc +0 -150
- package/src/child.h +0 -32
- package/src/crash.cc +0 -122
- package/src/crash.h +0 -30
- package/src/device.cc +0 -1350
- package/src/device.h +0 -56
- package/src/device_manager.cc +0 -362
- package/src/device_manager.h +0 -35
- package/src/endpoint_parameters.cc +0 -171
- package/src/endpoint_parameters.h +0 -28
- package/src/glib_context.cc +0 -62
- package/src/glib_context.h +0 -29
- package/src/glib_object.cc +0 -25
- package/src/glib_object.h +0 -37
- package/src/iostream.cc +0 -243
- package/src/iostream.h +0 -30
- package/src/operation.h +0 -94
- package/src/portal_membership.cc +0 -100
- package/src/portal_membership.h +0 -26
- package/src/portal_service.cc +0 -401
- package/src/portal_service.h +0 -40
- package/src/process.cc +0 -135
- package/src/process.h +0 -30
- package/src/relay.cc +0 -139
- package/src/relay.h +0 -31
- package/src/runtime.cc +0 -568
- package/src/runtime.h +0 -69
- package/src/script.cc +0 -301
- package/src/script.h +0 -36
- package/src/service.cc +0 -224
- package/src/service.h +0 -36
- package/src/session.cc +0 -860
- package/src/session.h +0 -42
- package/src/signals.cc +0 -334
- package/src/signals.h +0 -47
- package/src/spawn.cc +0 -95
- package/src/spawn.h +0 -27
- package/src/usage_monitor.h +0 -117
- package/src/uv_context.cc +0 -118
- package/src/uv_context.h +0 -40
- package/src/win_delay_load_hook.cc +0 -63
- package/subprojects/nan.wrap +0 -9
- package/subprojects/packagefiles/nan.patch +0 -13
package/lib/script.ts
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { Cancellable } from "./cancellable";
|
|
2
|
-
import { Signals, Signal, SignalHandler, SignalAdapter } from "./signals";
|
|
3
|
-
|
|
4
|
-
import { inspect } from "util";
|
|
5
|
-
|
|
6
|
-
export class Script {
|
|
7
|
-
destroyed: Signal<ScriptDestroyedHandler>;
|
|
8
|
-
message: Signal<ScriptMessageHandler>;
|
|
9
|
-
|
|
10
|
-
private exportsProxy: any;
|
|
11
|
-
private logHandlerImpl: ScriptLogHandler = log;
|
|
12
|
-
|
|
13
|
-
constructor(private impl: any) {
|
|
14
|
-
const services = new ScriptServices(this, impl.signals);
|
|
15
|
-
|
|
16
|
-
const rpcController: RpcController = services;
|
|
17
|
-
this.exportsProxy = new ScriptExportsProxy(rpcController);
|
|
18
|
-
|
|
19
|
-
const signals: Signals = services;
|
|
20
|
-
this.destroyed = new Signal<ScriptDestroyedHandler>(signals, "destroyed");
|
|
21
|
-
this.message = new Signal<ScriptMessageHandler>(signals, "message");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get isDestroyed(): boolean {
|
|
25
|
-
return this.impl.isDestroyed;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get exports(): ScriptExports {
|
|
29
|
-
return this.exportsProxy;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get logHandler(): ScriptLogHandler {
|
|
33
|
-
return this.logHandlerImpl;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
set logHandler(handler: ScriptLogHandler) {
|
|
37
|
-
this.logHandlerImpl = handler;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get defaultLogHandler(): ScriptLogHandler {
|
|
41
|
-
return log;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
load(cancellable?: Cancellable): Promise<void> {
|
|
45
|
-
return this.impl.load(cancellable);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
unload(cancellable?: Cancellable): Promise<void> {
|
|
49
|
-
return this.impl.unload(cancellable);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
eternalize(cancellable?: Cancellable): Promise<void> {
|
|
53
|
-
return this.impl.eternalize(cancellable);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
post(message: any, data: Buffer | null = null): void {
|
|
57
|
-
this.impl.post(message, data);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
enableDebugger(options: EnableDebuggerOptions = {}, cancellable?: Cancellable): Promise<void> {
|
|
61
|
-
const { port = 0 } = options;
|
|
62
|
-
|
|
63
|
-
return this.impl.enableDebugger(port, cancellable);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
disableDebugger(cancellable?: Cancellable): Promise<void> {
|
|
67
|
-
return this.impl.disableDebugger(cancellable);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
[inspect.custom](depth, options) {
|
|
71
|
-
return "Script {}";
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface ScriptOptions {
|
|
76
|
-
name?: string;
|
|
77
|
-
snapshot?: Buffer;
|
|
78
|
-
runtime?: ScriptRuntime;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface SnapshotOptions {
|
|
82
|
-
warmupScript?: string;
|
|
83
|
-
runtime?: ScriptRuntime;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export enum ScriptRuntime {
|
|
87
|
-
Default = "default",
|
|
88
|
-
QJS = "qjs",
|
|
89
|
-
V8 = "v8"
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type ScriptDestroyedHandler = () => void;
|
|
93
|
-
export type ScriptMessageHandler = (message: Message, data: Buffer | null) => void;
|
|
94
|
-
export type ScriptLogHandler = (level: LogLevel, text: string) => void;
|
|
95
|
-
|
|
96
|
-
export type Message = SendMessage | ErrorMessage;
|
|
97
|
-
|
|
98
|
-
export enum MessageType {
|
|
99
|
-
Send = "send",
|
|
100
|
-
Error = "error"
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface SendMessage {
|
|
104
|
-
type: MessageType.Send;
|
|
105
|
-
payload: any;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface ErrorMessage {
|
|
109
|
-
type: MessageType.Error;
|
|
110
|
-
description: string;
|
|
111
|
-
stack?: string;
|
|
112
|
-
fileName?: string;
|
|
113
|
-
lineNumber?: number;
|
|
114
|
-
columnNumber?: number;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface LogMessage {
|
|
118
|
-
type: "log";
|
|
119
|
-
level: LogLevel;
|
|
120
|
-
payload: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface ScriptExports {
|
|
124
|
-
[name: string]: (...args: any[]) => Promise<any>;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export enum LogLevel {
|
|
128
|
-
Info = "info",
|
|
129
|
-
Warning = "warning",
|
|
130
|
-
Error = "error"
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface EnableDebuggerOptions {
|
|
134
|
-
port?: number;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
class ScriptServices extends SignalAdapter implements RpcController {
|
|
138
|
-
private pendingRequests: { [id: string]: (error: Error | null, result?: any) => void } = {};
|
|
139
|
-
private nextRequestId: number = 1;
|
|
140
|
-
|
|
141
|
-
constructor(private script: Script, signals: Signals) {
|
|
142
|
-
super(signals);
|
|
143
|
-
|
|
144
|
-
this.signals.connect("destroyed", this.onDestroyed);
|
|
145
|
-
this.signals.connect("message", this.onMessage);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
protected getProxy(name: string, userHandler: SignalHandler): SignalHandler | null {
|
|
149
|
-
if (name === "message") {
|
|
150
|
-
return (message, data) => {
|
|
151
|
-
if (!isInternalMessage(message)) {
|
|
152
|
-
userHandler(message, data);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
private onDestroyed = () => {
|
|
161
|
-
this.signals.disconnect("destroyed", this.onDestroyed);
|
|
162
|
-
this.signals.disconnect("message", this.onMessage);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
private onMessage = (message: Message, data: Buffer | null) => {
|
|
166
|
-
if (message.type === MessageType.Send && isRpcSendMessage(message)) {
|
|
167
|
-
const [ , id, operation, ...params ] = message.payload;
|
|
168
|
-
this.onRpcMessage(id, operation, params, data);
|
|
169
|
-
} else if (isLogMessage(message)) {
|
|
170
|
-
const opaqueMessage: any = message;
|
|
171
|
-
const logMessage: LogMessage = opaqueMessage;
|
|
172
|
-
this.script.logHandler(logMessage.level, logMessage.payload);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
request(operation: string, params: any[], data: Buffer | null, cancellable?: Cancellable): Promise<any> {
|
|
177
|
-
return new Promise((resolve, reject) => {
|
|
178
|
-
const id = this.nextRequestId++;
|
|
179
|
-
|
|
180
|
-
const complete = (error: Error | null, result?: any): void => {
|
|
181
|
-
if (cancellable !== undefined) {
|
|
182
|
-
cancellable.cancelled.disconnect(onOperationCancelled);
|
|
183
|
-
}
|
|
184
|
-
this.signals.disconnect("destroyed", onScriptDestroyed);
|
|
185
|
-
|
|
186
|
-
delete this.pendingRequests[id];
|
|
187
|
-
|
|
188
|
-
if (error === null) {
|
|
189
|
-
resolve(result);
|
|
190
|
-
} else {
|
|
191
|
-
reject(error);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
function onScriptDestroyed(): void {
|
|
196
|
-
complete(new Error("Script is destroyed"));
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function onOperationCancelled(): void {
|
|
200
|
-
complete(new Error("Operation was cancelled"));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
this.pendingRequests[id] = complete;
|
|
204
|
-
|
|
205
|
-
this.script.post(["frida:rpc", id, operation, ...params], data);
|
|
206
|
-
this.signals.connect("destroyed", onScriptDestroyed);
|
|
207
|
-
if (cancellable !== undefined) {
|
|
208
|
-
cancellable.cancelled.connect(onOperationCancelled);
|
|
209
|
-
if (cancellable.isCancelled) {
|
|
210
|
-
onOperationCancelled();
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
if (this.script.isDestroyed) {
|
|
215
|
-
onScriptDestroyed();
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
onRpcMessage(id: number, operation: RpcOperation, params: any[], data: Buffer | null) {
|
|
221
|
-
if (operation === RpcOperation.Ok || operation === RpcOperation.Error) {
|
|
222
|
-
const callback = this.pendingRequests[id];
|
|
223
|
-
if (callback === undefined) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
let value = null;
|
|
228
|
-
let error = null;
|
|
229
|
-
if (operation === RpcOperation.Ok) {
|
|
230
|
-
if (data !== null) {
|
|
231
|
-
value = (params.length > 1) ? [params[1], data] : data;
|
|
232
|
-
} else {
|
|
233
|
-
value = params[0];
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
const [message, name, stack, rawErr] = params;
|
|
237
|
-
error = new Error(message);
|
|
238
|
-
error.name = name;
|
|
239
|
-
error.stack = stack;
|
|
240
|
-
Object.assign(error, rawErr);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
callback(error, value);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function ScriptExportsProxy(rpcController: RpcController): void {
|
|
249
|
-
return new Proxy(this, {
|
|
250
|
-
has(target, property) {
|
|
251
|
-
return !isReservedMethodName(property);;
|
|
252
|
-
},
|
|
253
|
-
get(target, property, receiver) {
|
|
254
|
-
if (property in target) {
|
|
255
|
-
return target[property];
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (property === inspect.custom) {
|
|
259
|
-
return inspectProxy;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (isReservedMethodName(property)) {
|
|
263
|
-
return undefined;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return (...args: any[]): Promise<any> => {
|
|
267
|
-
let cancellable: Cancellable | undefined;
|
|
268
|
-
if (args[args.length - 1] instanceof Cancellable) {
|
|
269
|
-
cancellable = args.pop();
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
let data: Buffer | null = null;
|
|
273
|
-
if (Buffer.isBuffer(args[args.length - 1])) {
|
|
274
|
-
data = args.pop();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return rpcController.request("call", [property, args], data, cancellable);
|
|
278
|
-
};
|
|
279
|
-
},
|
|
280
|
-
set(target, property, value, receiver) {
|
|
281
|
-
target[property] = value;
|
|
282
|
-
return true;
|
|
283
|
-
},
|
|
284
|
-
ownKeys(target) {
|
|
285
|
-
return Object.getOwnPropertyNames(target);
|
|
286
|
-
},
|
|
287
|
-
getOwnPropertyDescriptor(target, property) {
|
|
288
|
-
if (property in target) {
|
|
289
|
-
return Object.getOwnPropertyDescriptor(target, property);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (isReservedMethodName(property)) {
|
|
293
|
-
return undefined;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return {
|
|
297
|
-
writable: true,
|
|
298
|
-
configurable: true,
|
|
299
|
-
enumerable: true
|
|
300
|
-
};
|
|
301
|
-
},
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function inspectProxy() {
|
|
306
|
-
return "ScriptExportsProxy {}";
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
interface RpcController {
|
|
310
|
-
request(operation: string, params: any[], data: ArrayBuffer | null, cancellable?: Cancellable): Promise<any>;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
enum RpcOperation {
|
|
314
|
-
Ok = "ok",
|
|
315
|
-
Error = "error"
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function isInternalMessage(message: Message): boolean {
|
|
319
|
-
return isRpcMessage(message) || isLogMessage(message);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function isRpcMessage(message: Message): boolean {
|
|
323
|
-
return message.type === MessageType.Send && isRpcSendMessage(message);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function isRpcSendMessage(message: SendMessage): boolean {
|
|
327
|
-
const payload = message.payload;
|
|
328
|
-
if (!Array.isArray(payload)) {
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
return payload[0] === "frida:rpc";
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function isLogMessage(message: Message): boolean {
|
|
336
|
-
return message.type as string === "log";
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
function log(level: LogLevel, text: string): void {
|
|
340
|
-
switch (level) {
|
|
341
|
-
case LogLevel.Info:
|
|
342
|
-
console.log(text);
|
|
343
|
-
break;
|
|
344
|
-
case LogLevel.Warning:
|
|
345
|
-
console.warn(text);
|
|
346
|
-
break;
|
|
347
|
-
case LogLevel.Error:
|
|
348
|
-
console.error(text);
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
const reservedMethodNames = new Set<string>([
|
|
354
|
-
"then",
|
|
355
|
-
"catch",
|
|
356
|
-
"finally",
|
|
357
|
-
]);
|
|
358
|
-
|
|
359
|
-
function isReservedMethodName(name: string | number | symbol): boolean {
|
|
360
|
-
return reservedMethodNames.has(name.toString());
|
|
361
|
-
}
|
package/lib/service.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Cancellable } from "./cancellable";
|
|
2
|
-
import { Signals, Signal } from "./signals";
|
|
3
|
-
|
|
4
|
-
import { inspect } from "util";
|
|
5
|
-
|
|
6
|
-
export class Service {
|
|
7
|
-
close: Signal<ServiceCloseHandler>;
|
|
8
|
-
message: Signal<ServiceMessageHandler>;
|
|
9
|
-
|
|
10
|
-
constructor(private impl: any) {
|
|
11
|
-
const signals: Signals = impl.signals;
|
|
12
|
-
this.close = new Signal<ServiceCloseHandler>(signals, "close");
|
|
13
|
-
this.message = new Signal<ServiceMessageHandler>(signals, "message");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
activate(cancellable?: Cancellable): Promise<void> {
|
|
17
|
-
return this.impl.activate(cancellable);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
cancel(cancellable?: Cancellable): Promise<void> {
|
|
21
|
-
return this.impl.cancel(cancellable);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
request(parameters: any, cancellable?: Cancellable): Promise<any> {
|
|
25
|
-
return this.impl.request(parameters, cancellable);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
[inspect.custom](depth, options) {
|
|
29
|
-
return "Service {}";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type ServiceCloseHandler = () => void;
|
|
34
|
-
export type ServiceMessageHandler = (message: any) => void;
|
package/lib/session.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Cancellable } from "./cancellable";
|
|
2
|
-
import { Crash } from "./crash";
|
|
3
|
-
import { PortalMembership } from "./portal_membership";
|
|
4
|
-
import { Relay } from "./relay";
|
|
5
|
-
import { Script, ScriptOptions, SnapshotOptions } from "./script";
|
|
6
|
-
import { Signal } from "./signals";
|
|
7
|
-
|
|
8
|
-
import { inspect } from "util";
|
|
9
|
-
|
|
10
|
-
export class Session {
|
|
11
|
-
detached: Signal<SessionDetachedHandler>;
|
|
12
|
-
|
|
13
|
-
constructor(private impl: any) {
|
|
14
|
-
const { signals } = impl;
|
|
15
|
-
this.detached = new Signal<SessionDetachedHandler>(signals, "detached");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get pid(): number {
|
|
19
|
-
return this.impl.pid;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get persistTimeout(): number {
|
|
23
|
-
return this.impl.persistTimeout;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get isDetached(): boolean {
|
|
27
|
-
return this.impl.isDetached;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
detach(cancellable?: Cancellable): Promise<void> {
|
|
31
|
-
return this.impl.detach(cancellable);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
resume(cancellable?: Cancellable): Promise<void> {
|
|
35
|
-
return this.impl.resume(cancellable);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
enableChildGating(cancellable?: Cancellable): Promise<void> {
|
|
39
|
-
return this.impl.enableChildGating(cancellable);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
disableChildGating(cancellable?: Cancellable): Promise<void> {
|
|
43
|
-
return this.impl.disableChildGating(cancellable);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async createScript(source: string, options: ScriptOptions = {}, cancellable?: Cancellable): Promise<Script> {
|
|
47
|
-
const { name = null, snapshot = null, runtime = null } = options;
|
|
48
|
-
|
|
49
|
-
return new Script(await this.impl.createScript(source, name, snapshot, runtime, cancellable));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async createScriptFromBytes(bytes: Buffer, options: ScriptOptions = {}, cancellable?: Cancellable): Promise<Script> {
|
|
53
|
-
const { name = null, snapshot = null, runtime = null } = options;
|
|
54
|
-
|
|
55
|
-
return new Script(await this.impl.createScriptFromBytes(bytes, name, snapshot, runtime, cancellable));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
compileScript(source: string, options: ScriptOptions = {}, cancellable?: Cancellable): Promise<Buffer> {
|
|
59
|
-
const { name = null, runtime = null } = options;
|
|
60
|
-
|
|
61
|
-
return this.impl.compileScript(source, name, runtime, cancellable);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
snapshotScript(embedScript: string, options: SnapshotOptions = {}, cancellable?: Cancellable): Promise<Buffer> {
|
|
65
|
-
const { warmupScript = null, runtime = null } = options;
|
|
66
|
-
|
|
67
|
-
return this.impl.snapshotScript(embedScript, warmupScript, runtime, cancellable);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setupPeerConnection(options: PeerOptions = {}, cancellable?: Cancellable): Promise<void> {
|
|
71
|
-
const {
|
|
72
|
-
stunServer = null,
|
|
73
|
-
relays = [],
|
|
74
|
-
} = options;
|
|
75
|
-
return this.impl.setupPeerConnection(stunServer, relays, cancellable);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async joinPortal(address: string, options: PortalOptions = {}, cancellable?: Cancellable): Promise<PortalMembership> {
|
|
79
|
-
const {
|
|
80
|
-
certificate = null,
|
|
81
|
-
token = null,
|
|
82
|
-
acl = null,
|
|
83
|
-
} = options;
|
|
84
|
-
return new PortalMembership(await this.impl.joinPortal(address, certificate, token, acl, cancellable));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
[inspect.custom](depth, options) {
|
|
88
|
-
return "Session " + inspect({
|
|
89
|
-
pid: this.pid
|
|
90
|
-
}, options);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export type SessionDetachedHandler = (reason: SessionDetachReason, crash: Crash | null) => void;
|
|
95
|
-
|
|
96
|
-
export enum SessionDetachReason {
|
|
97
|
-
ApplicationRequested = "application-requested",
|
|
98
|
-
ProcessReplaced = "process-replaced",
|
|
99
|
-
ProcessTerminated = "process-terminated",
|
|
100
|
-
ConnectionTerminated = "connection-terminated",
|
|
101
|
-
DeviceLost = "device-lost"
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface PeerOptions {
|
|
105
|
-
stunServer?: string;
|
|
106
|
-
relays?: Relay[];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface PortalOptions {
|
|
110
|
-
certificate?: string;
|
|
111
|
-
token?: string;
|
|
112
|
-
acl?: string[];
|
|
113
|
-
}
|
package/lib/signals.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface Signals {
|
|
2
|
-
connect(name: string, handler: SignalHandler): void;
|
|
3
|
-
disconnect(name: string, handler: SignalHandler): void;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class Signal<T extends SignalHandler> {
|
|
7
|
-
constructor(private signals: Signals, private name: string) {
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
connect(handler: T): void {
|
|
11
|
-
this.signals.connect(this.name, handler);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
disconnect(handler: T): void {
|
|
15
|
-
this.signals.disconnect(this.name, handler);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type SignalHandler = (...args: any[]) => void;
|
|
20
|
-
|
|
21
|
-
export class SignalAdapter implements Signals {
|
|
22
|
-
private proxyHandlers: Map<SignalHandler, SignalHandler> = new Map();
|
|
23
|
-
|
|
24
|
-
constructor(protected signals: Signals) {
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
connect(name: string, handler: SignalHandler): void {
|
|
28
|
-
const proxyHandler = this.getProxy(name, handler);
|
|
29
|
-
if (proxyHandler !== null) {
|
|
30
|
-
this.proxyHandlers.set(handler, proxyHandler);
|
|
31
|
-
this.signals.connect(name, proxyHandler);
|
|
32
|
-
} else {
|
|
33
|
-
this.signals.connect(name, handler);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
disconnect(name: string, handler: SignalHandler): void {
|
|
38
|
-
const proxyHandler = this.proxyHandlers.get(handler);
|
|
39
|
-
this.signals.disconnect(name, (proxyHandler !== undefined) ? proxyHandler : handler);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
protected getProxy(name: string, userHandler: SignalHandler): SignalHandler | null {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
package/lib/socket_address.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export type SocketAddress =
|
|
2
|
-
| IPV4SocketAddress
|
|
3
|
-
| IPV6SocketAddress
|
|
4
|
-
| AnonymousUnixSocketAddress
|
|
5
|
-
| PathUnixSocketAddress
|
|
6
|
-
| AbstractUnixSocketAddress
|
|
7
|
-
;
|
|
8
|
-
|
|
9
|
-
export interface IPV4SocketAddress {
|
|
10
|
-
family: "ipv4";
|
|
11
|
-
address: string;
|
|
12
|
-
port: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IPV6SocketAddress {
|
|
16
|
-
family: "ipv6";
|
|
17
|
-
address: string;
|
|
18
|
-
port: number;
|
|
19
|
-
flowlabel: number;
|
|
20
|
-
scopeid: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface AnonymousUnixSocketAddress {
|
|
24
|
-
family: "unix:anonymous";
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface PathUnixSocketAddress {
|
|
28
|
-
family: "unix:path";
|
|
29
|
-
path: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AbstractUnixSocketAddress {
|
|
33
|
-
family: "unix:abstract";
|
|
34
|
-
path: Buffer;
|
|
35
|
-
}
|
package/lib/spawn.ts
DELETED
package/lib/system_parameters.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
export interface SystemParameters {
|
|
2
|
-
/**
|
|
3
|
-
* Operating System details.
|
|
4
|
-
*/
|
|
5
|
-
os: {
|
|
6
|
-
/**
|
|
7
|
-
* ID, e.g.: windows, macos, linux, ios, android, qnx, fedora, ubuntu, etc.
|
|
8
|
-
*/
|
|
9
|
-
id: string;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Human-readable name, e.g. `"macOS"`.
|
|
13
|
-
*/
|
|
14
|
-
name: string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Human-readable version string, e.g. `"11.2.2"`.
|
|
18
|
-
*/
|
|
19
|
-
version?: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Build version, e.g. `"21B91"`.
|
|
23
|
-
*/
|
|
24
|
-
build?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Platform, same as `Process.platform` in GumJS.
|
|
29
|
-
*/
|
|
30
|
-
platform: "windows" | "darwin" | "linux" | "qnx";
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Architecture, same as `Process.arch` in GumJS.
|
|
34
|
-
*/
|
|
35
|
-
arch: "ia32" | "x64" | "arm" | "arm64" | "mips";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Hardware details.
|
|
39
|
-
*/
|
|
40
|
-
hardware?: {
|
|
41
|
-
/**
|
|
42
|
-
* Product type, e.g. `"iPad6,3"`.
|
|
43
|
-
*/
|
|
44
|
-
product?: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Hardware platform, e.g. `"t8010"`.
|
|
48
|
-
*/
|
|
49
|
-
platform?: string;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Hardware model, e.g. `"J71bAP"`.
|
|
53
|
-
*/
|
|
54
|
-
model?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Level of access.
|
|
59
|
-
*/
|
|
60
|
-
access: "full" | "jailed";
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* System name, e.g. `"Ole André’s iPhone"`.
|
|
64
|
-
*/
|
|
65
|
-
name?: string;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* iOS UDID (Unique Device ID).
|
|
69
|
-
*/
|
|
70
|
-
udid?: string;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Details about cellular and networking interfaces.
|
|
74
|
-
*/
|
|
75
|
-
interfaces?: SystemInterface[];
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Android API level, e.g.: `30`.
|
|
79
|
-
*/
|
|
80
|
-
apiLevel?: number;
|
|
81
|
-
|
|
82
|
-
[name: string]: any;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type SystemInterface = NetworkInterface | CellularInterface;
|
|
86
|
-
|
|
87
|
-
export interface NetworkInterface {
|
|
88
|
-
type: "ethernet" | "wifi" | "bluetooth";
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* MAC address, e.g.: `"aa:bb:cc:dd:ee:ff"`.
|
|
92
|
-
*/
|
|
93
|
-
address: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface CellularInterface {
|
|
97
|
-
type: "cellular";
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Phone number, e.g. `"+47 123 45 678"`.
|
|
101
|
-
*/
|
|
102
|
-
phoneNumber: string;
|
|
103
|
-
}
|