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.
Files changed (172) hide show
  1. package/README.md +1 -10
  2. package/build/BSDmakefile +6 -0
  3. package/build/Makefile +10 -0
  4. package/build/src/frida.d.ts +364 -0
  5. package/build/src/frida.js +962 -0
  6. package/build/src/frida_binding.d.ts +938 -0
  7. package/meson.build +34 -67
  8. package/package.json +30 -20
  9. package/scripts/fetch-abi-bits.py +15 -65
  10. package/scripts/install.js +5 -4
  11. package/src/addon.def +3 -0
  12. package/src/addon.symbols +2 -1
  13. package/src/addon.version +4 -0
  14. package/src/frida_bindgen/__init__.py +0 -0
  15. package/src/frida_bindgen/__main__.py +4 -0
  16. package/src/frida_bindgen/__pycache__/__init__.cpython-312.pyc +0 -0
  17. package/src/frida_bindgen/__pycache__/__main__.cpython-312.pyc +0 -0
  18. package/src/frida_bindgen/__pycache__/cli.cpython-312.pyc +0 -0
  19. package/src/frida_bindgen/__pycache__/codegen.cpython-312.pyc +0 -0
  20. package/src/frida_bindgen/__pycache__/customization.cpython-312.pyc +0 -0
  21. package/src/frida_bindgen/__pycache__/loader.cpython-312.pyc +0 -0
  22. package/src/frida_bindgen/__pycache__/model.cpython-312.pyc +0 -0
  23. package/src/frida_bindgen/assets/codegen_helpers.c +1970 -0
  24. package/src/frida_bindgen/assets/codegen_helpers.ts +100 -0
  25. package/src/frida_bindgen/assets/codegen_prototypes.h +78 -0
  26. package/src/frida_bindgen/assets/codegen_types.h +57 -0
  27. package/src/frida_bindgen/assets/customization_facade.exports +13 -0
  28. package/src/frida_bindgen/assets/customization_facade.ts +157 -0
  29. package/src/frida_bindgen/assets/customization_helpers.imports +2 -0
  30. package/src/frida_bindgen/assets/customization_helpers.ts +396 -0
  31. package/src/frida_bindgen/cli.py +96 -0
  32. package/src/frida_bindgen/codegen.py +2233 -0
  33. package/src/frida_bindgen/customization.py +924 -0
  34. package/src/frida_bindgen/loader.py +60 -0
  35. package/src/frida_bindgen/model.py +1357 -0
  36. package/src/meson.build +92 -27
  37. package/{lib/build.py → src/tsc.py} +12 -12
  38. package/src/win_delay_load_hook.c +56 -0
  39. package/subprojects/frida-core.wrap +1 -1
  40. package/test/data/index.ts +2 -2
  41. package/test/device.ts +1 -2
  42. package/test/device_manager.ts +1 -2
  43. package/test/labrat.ts +2 -2
  44. package/test/script.ts +12 -12
  45. package/test/session.ts +3 -3
  46. package/tsconfig.json +6 -11
  47. package/dist/application.d.ts +0 -81
  48. package/dist/application.js +0 -2
  49. package/dist/authentication.d.ts +0 -3
  50. package/dist/authentication.js +0 -2
  51. package/dist/bus.d.ts +0 -16
  52. package/dist/bus.js +0 -23
  53. package/dist/cancellable.d.ts +0 -15
  54. package/dist/cancellable.js +0 -41
  55. package/dist/child.d.ts +0 -16
  56. package/dist/child.js +0 -9
  57. package/dist/crash.d.ts +0 -10
  58. package/dist/crash.js +0 -2
  59. package/dist/device.d.ts +0 -156
  60. package/dist/device.js +0 -188
  61. package/dist/device_manager.d.ts +0 -25
  62. package/dist/device_manager.js +0 -42
  63. package/dist/endpoint_parameters.d.ts +0 -26
  64. package/dist/endpoint_parameters.js +0 -24
  65. package/dist/icon.d.ts +0 -14
  66. package/dist/icon.js +0 -2
  67. package/dist/index.d.ts +0 -161
  68. package/dist/index.js +0 -170
  69. package/dist/iostream.d.ts +0 -13
  70. package/dist/iostream.js +0 -73
  71. package/dist/native.d.ts +0 -1
  72. package/dist/native.js +0 -11
  73. package/dist/portal_membership.d.ts +0 -6
  74. package/dist/portal_membership.js +0 -12
  75. package/dist/portal_service.d.ts +0 -48
  76. package/dist/portal_service.js +0 -52
  77. package/dist/process.d.ts +0 -47
  78. package/dist/process.js +0 -2
  79. package/dist/relay.d.ts +0 -22
  80. package/dist/relay.js +0 -32
  81. package/dist/script.d.ts +0 -70
  82. package/dist/script.js +0 -266
  83. package/dist/service.d.ts +0 -16
  84. package/dist/service.js +0 -26
  85. package/dist/session.d.ts +0 -45
  86. package/dist/session.js +0 -73
  87. package/dist/signals.d.ts +0 -20
  88. package/dist/signals.js +0 -40
  89. package/dist/socket_address.d.ts +0 -25
  90. package/dist/socket_address.js +0 -2
  91. package/dist/spawn.d.ts +0 -4
  92. package/dist/spawn.js +0 -2
  93. package/dist/system_parameters.d.ts +0 -84
  94. package/dist/system_parameters.js +0 -2
  95. package/lib/application.ts +0 -98
  96. package/lib/authentication.ts +0 -3
  97. package/lib/bus.ts +0 -30
  98. package/lib/cancellable.ts +0 -48
  99. package/lib/child.ts +0 -15
  100. package/lib/crash.ts +0 -11
  101. package/lib/device.ts +0 -331
  102. package/lib/device_manager.ts +0 -69
  103. package/lib/endpoint_parameters.ts +0 -56
  104. package/lib/icon.ts +0 -15
  105. package/lib/index.ts +0 -316
  106. package/lib/iostream.ts +0 -78
  107. package/lib/meson.build +0 -53
  108. package/lib/native.ts +0 -9
  109. package/lib/portal_membership.ts +0 -10
  110. package/lib/portal_service.ts +0 -105
  111. package/lib/process.ts +0 -57
  112. package/lib/relay.ts +0 -44
  113. package/lib/script.ts +0 -361
  114. package/lib/service.ts +0 -34
  115. package/lib/session.ts +0 -113
  116. package/lib/signals.ts +0 -45
  117. package/lib/socket_address.ts +0 -35
  118. package/lib/spawn.ts +0 -4
  119. package/lib/system_parameters.ts +0 -103
  120. package/meson.options +0 -11
  121. package/src/addon.cc +0 -78
  122. package/src/application.cc +0 -148
  123. package/src/application.h +0 -31
  124. package/src/authentication.cc +0 -174
  125. package/src/authentication.h +0 -24
  126. package/src/bus.cc +0 -167
  127. package/src/bus.h +0 -33
  128. package/src/cancellable.cc +0 -117
  129. package/src/cancellable.h +0 -31
  130. package/src/child.cc +0 -150
  131. package/src/child.h +0 -32
  132. package/src/crash.cc +0 -122
  133. package/src/crash.h +0 -30
  134. package/src/device.cc +0 -1350
  135. package/src/device.h +0 -56
  136. package/src/device_manager.cc +0 -362
  137. package/src/device_manager.h +0 -35
  138. package/src/endpoint_parameters.cc +0 -171
  139. package/src/endpoint_parameters.h +0 -28
  140. package/src/glib_context.cc +0 -62
  141. package/src/glib_context.h +0 -29
  142. package/src/glib_object.cc +0 -25
  143. package/src/glib_object.h +0 -37
  144. package/src/iostream.cc +0 -243
  145. package/src/iostream.h +0 -30
  146. package/src/operation.h +0 -94
  147. package/src/portal_membership.cc +0 -100
  148. package/src/portal_membership.h +0 -26
  149. package/src/portal_service.cc +0 -401
  150. package/src/portal_service.h +0 -40
  151. package/src/process.cc +0 -135
  152. package/src/process.h +0 -30
  153. package/src/relay.cc +0 -139
  154. package/src/relay.h +0 -31
  155. package/src/runtime.cc +0 -568
  156. package/src/runtime.h +0 -69
  157. package/src/script.cc +0 -301
  158. package/src/script.h +0 -36
  159. package/src/service.cc +0 -224
  160. package/src/service.h +0 -36
  161. package/src/session.cc +0 -860
  162. package/src/session.h +0 -42
  163. package/src/signals.cc +0 -334
  164. package/src/signals.h +0 -47
  165. package/src/spawn.cc +0 -95
  166. package/src/spawn.h +0 -27
  167. package/src/usage_monitor.h +0 -117
  168. package/src/uv_context.cc +0 -118
  169. package/src/uv_context.h +0 -40
  170. package/src/win_delay_load_hook.cc +0 -63
  171. package/subprojects/nan.wrap +0 -9
  172. package/subprojects/packagefiles/nan.patch +0 -13
package/lib/index.ts DELETED
@@ -1,316 +0,0 @@
1
- import * as applicationModule from "./application";
2
- import * as authenticationModule from "./authentication";
3
- import * as busModule from "./bus";
4
- import * as cancellableModule from "./cancellable";
5
- import * as childModule from "./child";
6
- import * as crashModule from "./crash";
7
- import * as deviceManagerModule from "./device_manager";
8
- import * as deviceModule from "./device";
9
- import * as endpointParametersModule from "./endpoint_parameters";
10
- import * as iconModule from "./icon";
11
- import * as iostreamModule from "./iostream";
12
- import * as portalMembershipModule from "./portal_membership";
13
- import * as portalServiceModule from "./portal_service";
14
- import * as processModule from "./process";
15
- import * as relayModule from "./relay";
16
- import * as scriptModule from "./script";
17
- import * as serviceModule from "./service";
18
- import * as sessionModule from "./session";
19
- import * as socketAddressModule from "./socket_address";
20
- import * as spawnModule from "./spawn";
21
- import * as systemParametersModule from "./system_parameters";
22
-
23
- export type DeviceManager = deviceManagerModule.DeviceManager;
24
- export const DeviceManager = deviceManagerModule.DeviceManager;
25
- export type RemoteDeviceOptions = deviceManagerModule.RemoteDeviceOptions;
26
- export type DeviceAddedHandler = deviceManagerModule.DeviceAddedHandler;
27
- export type DeviceRemovedHandler = deviceManagerModule.DeviceRemovedHandler;
28
- export type DevicesChangedHandler = deviceManagerModule.DevicesChangedHandler;
29
-
30
- export type Device = deviceModule.Device;
31
- export const Device = deviceModule.Device;
32
- export type ProcessID = deviceModule.ProcessID;
33
- export type ProcessName = deviceModule.ProcessName;
34
- export type InjecteeID = deviceModule.InjecteeID;
35
- export type FileDescriptor = deviceModule.FileDescriptor;
36
- export type SpawnAddedHandler = deviceModule.SpawnAddedHandler;
37
- export type SpawnRemovedHandler = deviceModule.SpawnRemovedHandler;
38
- export type ChildAddedHandler = deviceModule.ChildAddedHandler;
39
- export type ChildRemovedHandler = deviceModule.ChildRemovedHandler;
40
- export type OutputHandler = deviceModule.OutputHandler;
41
- export type UninjectedHandler = deviceModule.UninjectedHandler;
42
- export type DeviceLostHandler = deviceModule.DeviceLostHandler;
43
- export type DeviceType = deviceModule.DeviceType;
44
- export const DeviceType = deviceModule.DeviceType;
45
- export type FrontmostQueryOptions = deviceModule.FrontmostQueryOptions;
46
- export type ApplicationQueryOptions = deviceModule.ApplicationQueryOptions;
47
- export type ProcessQueryOptions = deviceModule.ProcessQueryOptions;
48
- export type ProcessMatchOptions = deviceModule.ProcessMatchOptions;
49
- export type Scope = deviceModule.Scope;
50
- export const Scope = deviceModule.Scope;
51
- export type SpawnOptions = deviceModule.SpawnOptions;
52
- export type Stdio = deviceModule.Stdio;
53
- export const Stdio = deviceModule.Stdio;
54
- export type TargetProcess = deviceModule.TargetProcess;
55
- export type SessionOptions = deviceModule.SessionOptions;
56
- export type Realm = deviceModule.Realm;
57
- export const Realm = deviceModule.Realm;
58
-
59
- export type SystemParameters = systemParametersModule.SystemParameters;
60
- export type SystemInterface = systemParametersModule.SystemInterface;
61
- export type NetworkInterface = systemParametersModule.NetworkInterface;
62
- export type CellularInterface = systemParametersModule.CellularInterface;
63
-
64
- export type Session = sessionModule.Session;
65
- export const Session = sessionModule.Session;
66
- export type SessionDetachedHandler = sessionModule.SessionDetachedHandler;
67
- export type SessionDetachReason = sessionModule.SessionDetachReason;
68
- export const SessionDetachReason = sessionModule.SessionDetachReason;
69
- export type PeerOptions = sessionModule.PeerOptions;
70
- export type PortalOptions = sessionModule.PortalOptions;
71
-
72
- export type Script = scriptModule.Script;
73
- export const Script = scriptModule.Script;
74
- export type ScriptOptions = scriptModule.ScriptOptions;
75
- export type SnapshotOptions = scriptModule.SnapshotOptions;
76
- export type ScriptRuntime = scriptModule.ScriptRuntime;
77
- export const ScriptRuntime = scriptModule.ScriptRuntime;
78
- export type ScriptDestroyedHandler = scriptModule.ScriptDestroyedHandler;
79
- export type ScriptMessageHandler = scriptModule.ScriptMessageHandler;
80
- export type ScriptLogHandler = scriptModule.ScriptLogHandler;
81
- export type Message = scriptModule.Message;
82
- export type MessageType = scriptModule.MessageType;
83
- export const MessageType = scriptModule.MessageType;
84
- export type SendMessage = scriptModule.SendMessage;
85
- export type ErrorMessage = scriptModule.ErrorMessage;
86
- export type ScriptExports = scriptModule.ScriptExports;
87
- export type LogLevel = scriptModule.LogLevel;
88
- export const LogLevel = scriptModule.LogLevel;
89
- export type EnableDebuggerOptions = scriptModule.EnableDebuggerOptions;
90
-
91
- export type Relay = relayModule.Relay;
92
- export const Relay = relayModule.Relay;
93
- export type RelayProperties = relayModule.RelayProperties;
94
- export type RelayKind = relayModule.RelayKind;
95
- export const RelayKind = relayModule.RelayKind;
96
-
97
- export type PortalMembership = portalMembershipModule.PortalMembership;
98
- export const PortalMembership = portalMembershipModule.PortalMembership;
99
-
100
- export type PortalService = portalServiceModule.PortalService;
101
- export const PortalService = portalServiceModule.PortalService;
102
- export type PortalServiceOptions = portalServiceModule.PortalServiceOptions;
103
- export type PortalConnectionId = portalServiceModule.PortalConnectionId;
104
- export type PortalConnectionTag = portalServiceModule.PortalConnectionTag;
105
- export type PortalNodeConnectedHandler = portalServiceModule.PortalNodeConnectedHandler;
106
- export type PortalNodeJoinedHandler = portalServiceModule.PortalNodeJoinedHandler;
107
- export type PortalNodeLeftHandler = portalServiceModule.PortalNodeLeftHandler;
108
- export type PortalNodeDisconnectedHandler = portalServiceModule.PortalNodeDisconnectedHandler;
109
- export type PortalControllerConnectedHandler = portalServiceModule.PortalControllerConnectedHandler;
110
- export type PortalControllerDisconnectedHandler = portalServiceModule.PortalControllerDisconnectedHandler;
111
- export type PortalAuthenticatedHandler = portalServiceModule.PortalAuthenticatedHandler;
112
- export type PortalSubscribeHandler = portalServiceModule.PortalSubscribeHandler;
113
- export type PortalMessageHandler = portalServiceModule.PortalMessageHandler;
114
-
115
- export type EndpointParameters = endpointParametersModule.EndpointParameters;
116
- export const EndpointParameters = endpointParametersModule.EndpointParameters;
117
- export type EndpointParametersSubset = endpointParametersModule.EndpointParametersSubset;
118
- export type AuthenticationScheme = endpointParametersModule.AuthenticationScheme;
119
- export type TokenAuthenticationScheme = endpointParametersModule.TokenAuthenticationScheme;
120
- export type CallbackAuthenticationScheme = endpointParametersModule.CallbackAuthenticationScheme;
121
- export type AuthenticationCallback = endpointParametersModule.AuthenticationCallback;
122
-
123
- export type AuthenticatedSessionInfo = authenticationModule.AuthenticatedSessionInfo;
124
-
125
- export type IOStream = iostreamModule.IOStream;
126
- export const IOStream = iostreamModule.IOStream;
127
- export type Cancellable = cancellableModule.Cancellable;
128
- export const Cancellable = cancellableModule.Cancellable;
129
-
130
- export type Application = applicationModule.Application;
131
- export type ApplicationParameters = applicationModule.ApplicationParameters;
132
- export type Process = processModule.Process;
133
- export type ProcessParameters = processModule.ProcessParameters;
134
- export type Spawn = spawnModule.Spawn;
135
- export type Child = childModule.Child;
136
- export type ChildOrigin = childModule.ChildOrigin;
137
- export const ChildOrigin = childModule.ChildOrigin;
138
- export type Crash = crashModule.Crash;
139
- export type CrashParameters = crashModule.CrashParameters;
140
- export type Icon = iconModule.Icon;
141
- export type RGBAIcon = iconModule.RGBAIcon;
142
- export type PNGIcon = iconModule.PNGIcon;
143
- export type Bus = busModule.Bus;
144
- export const Bus = busModule.Bus;
145
- export type BusDetachedHandler = busModule.BusDetachedHandler;
146
- export type BusMessageHandler = busModule.BusMessageHandler;
147
- export type Service = serviceModule.Service;
148
- export const Service = serviceModule.Service;
149
- export type ServiceCloseHandler = serviceModule.ServiceCloseHandler;
150
- export type ServiceMessageHandler = serviceModule.ServiceMessageHandler;
151
- export type SocketAddress = socketAddressModule.SocketAddress;
152
- export type IPV4SocketAddress = socketAddressModule.IPV4SocketAddress;
153
- export type IPV6SocketAddress = socketAddressModule.IPV6SocketAddress;
154
- export type AnonymousUnixSocketAddress = socketAddressModule.AnonymousUnixSocketAddress;
155
- export type PathUnixSocketAddress = socketAddressModule.PathUnixSocketAddress;
156
- export type AbstractUnixSocketAddress = socketAddressModule.AbstractUnixSocketAddress;
157
-
158
- let sharedDeviceManager: DeviceManager = null;
159
-
160
- export async function querySystemParameters(cancellable?: Cancellable): Promise<SystemParameters> {
161
- const device = await getLocalDevice(cancellable);
162
- return await device.querySystemParameters(cancellable);
163
- }
164
-
165
- export async function spawn(program: string | string[], options: SpawnOptions = {}, cancellable?: Cancellable): Promise<number> {
166
- const device = await getLocalDevice(cancellable);
167
- return await device.spawn(program, options, cancellable);
168
- }
169
-
170
- export async function resume(target: number | string, cancellable?: Cancellable): Promise<void> {
171
- const device = await getLocalDevice(cancellable);
172
- await device.resume(target, cancellable);
173
- }
174
-
175
- export async function kill(target: number | string, cancellable?: Cancellable): Promise<void> {
176
- const device = await getLocalDevice(cancellable);
177
- await device.kill(target, cancellable);
178
- }
179
-
180
- export async function attach(target: TargetProcess, options: SessionOptions = {}, cancellable?: Cancellable): Promise<Session> {
181
- const device = await getLocalDevice(cancellable);
182
- return await device.attach(target, options, cancellable);
183
- }
184
-
185
- export async function injectLibraryFile(target: number | string, path: string, entrypoint: string, data: string,
186
- cancellable?: Cancellable): Promise<number> {
187
- const device = await getLocalDevice(cancellable);
188
- return await device.injectLibraryFile(target, path, entrypoint, data, cancellable);
189
- }
190
-
191
- export async function injectLibraryBlob(target: number | string, blob: Buffer, entrypoint: string, data: string,
192
- cancellable?: Cancellable): Promise<number> {
193
- const device = await getLocalDevice(cancellable);
194
- return await device.injectLibraryBlob(target, blob, entrypoint, data, cancellable);
195
- }
196
-
197
- export async function enumerateDevices(cancellable?: Cancellable): Promise<Device[]> {
198
- const deviceManager = getDeviceManager();
199
- return await deviceManager.enumerateDevices(cancellable);
200
- };
201
-
202
- export function getDeviceManager(): DeviceManager {
203
- if (sharedDeviceManager === null) {
204
- sharedDeviceManager = new deviceManagerModule.DeviceManager();
205
- }
206
- return sharedDeviceManager;
207
- }
208
-
209
- export function getLocalDevice(cancellable?: Cancellable): Promise<Device> {
210
- return getMatchingDevice(device => device.type === DeviceType.Local, {}, cancellable);
211
- }
212
-
213
- export function getRemoteDevice(cancellable?: Cancellable): Promise<Device> {
214
- return getMatchingDevice(device => device.type === DeviceType.Remote, {}, cancellable);
215
- }
216
-
217
- export function getUsbDevice(options?: GetDeviceOptions, cancellable?: Cancellable): Promise<Device> {
218
- return getMatchingDevice(device => device.type === DeviceType.Usb, options, cancellable);
219
- }
220
-
221
- export function getDevice(id: string, options?: GetDeviceOptions, cancellable?: Cancellable): Promise<Device> {
222
- return getMatchingDevice(device => device.id === id, options, cancellable);
223
- }
224
-
225
- export interface GetDeviceOptions {
226
- timeout?: number | null;
227
- }
228
-
229
- async function getMatchingDevice(predicate: DevicePredicate, options: GetDeviceOptions = {}, cancellable?: Cancellable): Promise<Device> {
230
- const device = await findMatchingDevice(predicate, cancellable);
231
- if (device !== null) {
232
- return device;
233
- }
234
-
235
- const { timeout = 0 } = options;
236
- if (timeout === 0) {
237
- throw new Error("Device not found");
238
- }
239
-
240
- const getDeviceEventually = new Promise((resolve: (device: Device) => void, reject: (error: Error) => void) => {
241
- const deviceManager = getDeviceManager();
242
-
243
- deviceManager.added.connect(onDeviceAdded);
244
-
245
- const timer = (timeout !== null) ? setTimeout(onTimeout, timeout) : null;
246
-
247
- if (cancellable !== undefined) {
248
- cancellable.cancelled.connect(onCancel);
249
- if (cancellable.isCancelled) {
250
- onCancel();
251
- return;
252
- }
253
- }
254
-
255
- findMatchingDevice(predicate, cancellable)
256
- .then(device => {
257
- if (device !== null) {
258
- onSuccess(device);
259
- }
260
- })
261
- .catch(onError);
262
-
263
- function onDeviceAdded(device: Device): void {
264
- if (predicate(device)) {
265
- onSuccess(device);
266
- }
267
- }
268
-
269
- function onSuccess(device: Device): void {
270
- stopMonitoring();
271
- resolve(device);
272
- }
273
-
274
- function onError(error: Error): void {
275
- stopMonitoring();
276
- reject(error);
277
- }
278
-
279
- function onTimeout(): void {
280
- onError(new Error("Timed out while waiting for device to appear"));
281
- }
282
-
283
- function onCancel(): void {
284
- onError(new Error("Operation was cancelled"));
285
- }
286
-
287
- function stopMonitoring(): void {
288
- if (cancellable !== undefined) {
289
- cancellable.cancelled.disconnect(onCancel);
290
- }
291
-
292
- if (timer !== null) {
293
- clearTimeout(timer);
294
- }
295
-
296
- deviceManager.added.disconnect(onDeviceAdded);
297
- }
298
- });
299
-
300
- return await getDeviceEventually;
301
- }
302
-
303
- async function findMatchingDevice(predicate: DevicePredicate, cancellable?: Cancellable): Promise<Device | null> {
304
- const deviceManager = getDeviceManager();
305
-
306
- const devices = await deviceManager.enumerateDevices(cancellable);
307
-
308
- const matching = devices.filter(predicate);
309
- if (matching.length === 0) {
310
- return null;
311
- }
312
-
313
- return matching[0];
314
- }
315
-
316
- type DevicePredicate = (device: Device) => boolean;
package/lib/iostream.ts DELETED
@@ -1,78 +0,0 @@
1
- import { Cancellable } from "./cancellable";
2
-
3
- import { Duplex } from "stream";
4
-
5
- export class IOStream extends Duplex {
6
- private pending = new Set<Promise<void>>();
7
-
8
- private cancellable = new Cancellable();
9
-
10
- constructor(private impl: any) {
11
- super({});
12
- }
13
-
14
- async _destroy(error: Error | null, callback: (error: Error | null) => void): Promise<void> {
15
- this.cancellable.cancel();
16
-
17
- for (const operation of this.pending) {
18
- try {
19
- await operation;
20
- } catch (e) {
21
- }
22
- }
23
-
24
- try {
25
- await this.impl.close();
26
- } catch (e) {
27
- }
28
-
29
- callback(error);
30
- }
31
-
32
- _read(size: number): void {
33
- const operation = this.impl.read(size, this.cancellable)
34
- .then((data: Buffer): void => {
35
- const isEof = data.length === 0;
36
- if (isEof) {
37
- this.push(null);
38
- return;
39
- }
40
-
41
- this.push(data);
42
- })
43
- .catch((error: Error): void => {
44
- if (this.impl.isClosed) {
45
- this.push(null);
46
- }
47
- this.emit("error", error);
48
- });
49
- this.track(operation);
50
- }
51
-
52
- _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void {
53
- let data: Buffer;
54
- if (Buffer.isBuffer(chunk)) {
55
- data = chunk;
56
- } else {
57
- data = Buffer.from(chunk, encoding);
58
- }
59
-
60
- const operation = this.impl.write(data, this.cancellable)
61
- .then((): void => {
62
- callback(null);
63
- })
64
- .catch((error: Error): void => {
65
- callback(error);
66
- });
67
- this.track(operation);
68
- }
69
-
70
- private track(operation: Promise<void>): void {
71
- this.pending.add(operation);
72
- operation
73
- .catch(_ => {})
74
- .finally(() => {
75
- this.pending.delete(operation);
76
- });
77
- }
78
- }
package/lib/meson.build DELETED
@@ -1,53 +0,0 @@
1
- sources = [
2
- 'index.ts',
3
-
4
- 'application.ts',
5
- 'authentication.ts',
6
- 'bus.ts',
7
- 'cancellable.ts',
8
- 'child.ts',
9
- 'crash.ts',
10
- 'device.ts',
11
- 'device_manager.ts',
12
- 'endpoint_parameters.ts',
13
- 'icon.ts',
14
- 'iostream.ts',
15
- 'native.ts',
16
- 'portal_membership.ts',
17
- 'portal_service.ts',
18
- 'process.ts',
19
- 'relay.ts',
20
- 'script.ts',
21
- 'service.ts',
22
- 'session.ts',
23
- 'signals.ts',
24
- 'socket_address.ts',
25
- 'spawn.ts',
26
- 'system_parameters.ts',
27
- ]
28
-
29
- outputs = []
30
- foreach s : sources
31
- stem = s.split('.')[0]
32
- outputs += [
33
- stem + '.js',
34
- stem + '.d.ts',
35
- ]
36
- endforeach
37
-
38
- custom_target('js',
39
- input: sources,
40
- output: outputs,
41
- command: [
42
- python,
43
- files('build.py'),
44
- '@OUTDIR@',
45
- '@PRIVATE_DIR@',
46
- npm,
47
- package_json,
48
- tsconfig_json,
49
- '@INPUT@',
50
- ],
51
- install: true,
52
- install_dir: pkg_install_dir / 'dist',
53
- )
package/lib/native.ts DELETED
@@ -1,9 +0,0 @@
1
- import * as bindings from "bindings";
2
-
3
- export const binding = bindings({
4
- bindings: "frida_binding",
5
- try: [
6
- ["module_root", "build", "bindings"],
7
- [process.cwd(), "bindings"],
8
- ]
9
- });
@@ -1,10 +0,0 @@
1
- import { Cancellable } from "./cancellable";
2
-
3
- export class PortalMembership {
4
- constructor(private impl: any) {
5
- }
6
-
7
- terminate(cancellable?: Cancellable): Promise<void> {
8
- return this.impl.terminate(cancellable);
9
- }
10
- }
@@ -1,105 +0,0 @@
1
- import { Application } from "./application";
2
- import { AuthenticatedSessionInfo } from "./authentication";
3
- import { Cancellable } from "./cancellable";
4
- import { Device } from "./device";
5
- import { EndpointParameters } from "./endpoint_parameters";
6
- import { binding } from "./native";
7
- import { Signal } from "./signals";
8
- import { SocketAddress } from "./socket_address";
9
-
10
- import { inspect } from "util";
11
-
12
- export class PortalService {
13
- nodeConnected: Signal<PortalNodeConnectedHandler>;
14
- nodeJoined: Signal<PortalNodeJoinedHandler>;
15
- nodeLeft: Signal<PortalNodeLeftHandler>;
16
- nodeDisconnected: Signal<PortalNodeDisconnectedHandler>;
17
-
18
- controllerConnected: Signal<PortalControllerConnectedHandler>;
19
- controllerDisconnected: Signal<PortalControllerDisconnectedHandler>;
20
-
21
- authenticated: Signal<PortalAuthenticatedHandler>;
22
- subscribe: Signal<PortalSubscribeHandler>;
23
- message: Signal<PortalMessageHandler>;
24
-
25
- device: Device;
26
-
27
- private impl: any;
28
-
29
- constructor({ clusterParams = null, controlParams = null }: PortalServiceOptions = {}) {
30
- const impl = new binding.PortalService(clusterParams, controlParams);
31
- this.impl = impl;
32
-
33
- this.device = new Device(impl.device);
34
-
35
- const { signals } = impl;
36
-
37
- this.nodeConnected = new Signal<PortalNodeConnectedHandler>(signals, "node-connected");
38
- this.nodeJoined = new Signal<PortalNodeJoinedHandler>(signals, "node-joined");
39
- this.nodeLeft = new Signal<PortalNodeLeftHandler>(signals, "node-left");
40
- this.nodeDisconnected = new Signal<PortalNodeDisconnectedHandler>(signals, "node-disconnected");
41
-
42
- this.controllerConnected = new Signal<PortalControllerConnectedHandler>(signals, "controller-connected");
43
- this.controllerDisconnected = new Signal<PortalControllerDisconnectedHandler>(signals, "controller-disconnected");
44
-
45
- this.authenticated = new Signal<PortalAuthenticatedHandler>(signals, "authenticated");
46
- this.subscribe = new Signal<PortalSubscribeHandler>(signals, "subscribe");
47
- this.message = new Signal<PortalMessageHandler>(signals, "message");
48
- }
49
-
50
- start(cancellable?: Cancellable): Promise<void> {
51
- return this.impl.start(cancellable);
52
- }
53
-
54
- stop(cancellable?: Cancellable): Promise<void> {
55
- return this.impl.stop(cancellable);
56
- }
57
-
58
- post(connectionId: PortalConnectionId, message: any, data: Buffer | null = null): void {
59
- this.impl.post(connectionId, message, data);
60
- }
61
-
62
- narrowcast(tag: PortalConnectionTag, message: any, data: Buffer | null = null): void {
63
- this.impl.narrowcast(tag, message, data);
64
- }
65
-
66
- broadcast(message: any, data: Buffer | null = null): void {
67
- this.impl.broadcast(message, data);
68
- }
69
-
70
- enumerateTags(connectionId: PortalConnectionId): Promise<PortalConnectionTag[]> {
71
- return this.impl.enumerateTags(connectionId);
72
- }
73
-
74
- tag(connectionId: PortalConnectionId, tag: PortalConnectionTag): void {
75
- this.impl.tag(connectionId, tag);
76
- }
77
-
78
- untag(connectionId: PortalConnectionId, tag: PortalConnectionTag): void {
79
- this.impl.untag(connectionId, tag);
80
- }
81
-
82
- [inspect.custom]() {
83
- return "PortalService {}";
84
- }
85
- }
86
-
87
- export interface PortalServiceOptions {
88
- clusterParams?: EndpointParameters;
89
- controlParams?: EndpointParameters;
90
- }
91
-
92
- export type PortalConnectionId = number;
93
- export type PortalConnectionTag = string;
94
-
95
- export type PortalNodeConnectedHandler = (connectionId: PortalConnectionId, remoteAddress: SocketAddress) => void;
96
- export type PortalNodeJoinedHandler = (connectionId: PortalConnectionId, application: Application) => void;
97
- export type PortalNodeLeftHandler = (connectionId: PortalConnectionId, application: Application) => void;
98
- export type PortalNodeDisconnectedHandler = (connectionId: PortalConnectionId, remoteAddress: SocketAddress) => void;
99
-
100
- export type PortalControllerConnectedHandler = (connectionId: PortalConnectionId, remoteAddress: SocketAddress) => void;
101
- export type PortalControllerDisconnectedHandler = (connectionId: PortalConnectionId, remoteAddress: SocketAddress) => void;
102
-
103
- export type PortalAuthenticatedHandler = (connectionId: PortalConnectionId, sessionInfo: AuthenticatedSessionInfo) => void;
104
- export type PortalSubscribeHandler = (connectionId: PortalConnectionId) => void;
105
- export type PortalMessageHandler = (connectionId: PortalConnectionId, message: any, data: Buffer | null) => void;
package/lib/process.ts DELETED
@@ -1,57 +0,0 @@
1
- import { Icon } from "./icon";
2
- import { SystemParameters } from "./system_parameters";
3
-
4
- export interface Process {
5
- pid: number;
6
- name: string;
7
- parameters: ProcessParameters;
8
- }
9
-
10
- /**
11
- * Process parameters typically obtained through `enumerateProcesses({ scope })`, where
12
- * `scope` is either `Scope.Metadata` or `Scope.Full`. The default of `Scope.Minimal`
13
- * means no parameters will be included.
14
- */
15
- export interface ProcessParameters {
16
- /**
17
- * Filesystem path of program.
18
- */
19
- path?: string;
20
-
21
- /**
22
- * Name of user that the process is running as.
23
- */
24
- user?: string;
25
-
26
- /**
27
- * Parent process ID.
28
- */
29
- ppid?: number;
30
-
31
- /**
32
- * When the process was started.
33
- */
34
- started?: Date;
35
-
36
- /**
37
- * Application IDs that have code running inside this process.
38
- */
39
- applications?: string[];
40
-
41
- /**
42
- * Whether the process is currently frontmost.
43
- */
44
- frontmost?: boolean;
45
-
46
- /**
47
- * One or more icons. Only included when `scope` is set to `Scope.Full`.
48
- */
49
- icons?: Icon[];
50
-
51
- /**
52
- * System parameters, available for processes accessed through a portal.
53
- */
54
- system?: SystemParameters;
55
-
56
- [name: string]: any;
57
- }
package/lib/relay.ts DELETED
@@ -1,44 +0,0 @@
1
- import { binding } from "./native";
2
-
3
- import { inspect } from "util";
4
-
5
- export class Relay {
6
- private impl: RelayProperties;
7
-
8
- constructor({ address, username, password, kind }: RelayProperties) {
9
- this.impl = new binding.Relay(address, username, password, kind);
10
- }
11
-
12
- get address(): string {
13
- return this.impl.address;
14
- }
15
-
16
- get username(): string {
17
- return this.impl.username;
18
- }
19
-
20
- get password(): string {
21
- return this.impl.password;
22
- }
23
-
24
- get kind(): RelayKind {
25
- return this.impl.kind;
26
- }
27
-
28
- [inspect.custom](depth, options) {
29
- return inspect(this.impl, { ...options, depth });
30
- }
31
- }
32
-
33
- export interface RelayProperties {
34
- address: string;
35
- username: string;
36
- password: string;
37
- kind: RelayKind;
38
- }
39
-
40
- export enum RelayKind {
41
- TurnUDP = "turn-udp",
42
- TurnTCP = "turn-tcp",
43
- TurnTLS = "turn-tls"
44
- }