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/src/session.cc
DELETED
|
@@ -1,860 +0,0 @@
|
|
|
1
|
-
#include "session.h"
|
|
2
|
-
|
|
3
|
-
#include "crash.h"
|
|
4
|
-
#include "operation.h"
|
|
5
|
-
#include "portal_membership.h"
|
|
6
|
-
#include "relay.h"
|
|
7
|
-
#include "script.h"
|
|
8
|
-
#include "signals.h"
|
|
9
|
-
#include "usage_monitor.h"
|
|
10
|
-
|
|
11
|
-
#include <cstring>
|
|
12
|
-
|
|
13
|
-
#define SESSION_DATA_CONSTRUCTOR "session:ctor"
|
|
14
|
-
|
|
15
|
-
using std::strcmp;
|
|
16
|
-
using v8::Array;
|
|
17
|
-
using v8::DEFAULT;
|
|
18
|
-
using v8::External;
|
|
19
|
-
using v8::Function;
|
|
20
|
-
using v8::Isolate;
|
|
21
|
-
using v8::Local;
|
|
22
|
-
using v8::Object;
|
|
23
|
-
using v8::Persistent;
|
|
24
|
-
using v8::ReadOnly;
|
|
25
|
-
using v8::String;
|
|
26
|
-
using v8::Uint32;
|
|
27
|
-
using v8::Value;
|
|
28
|
-
|
|
29
|
-
namespace frida {
|
|
30
|
-
|
|
31
|
-
static FridaScriptOptions* ParseScriptOptions(Local<Value> name_value,
|
|
32
|
-
Local<Value> snapshot_value, Local<Value> runtime_value);
|
|
33
|
-
static FridaSnapshotOptions* ParseSnapshotOptions(
|
|
34
|
-
Local<Value> warmup_script_value, Local<Value> runtime_value);
|
|
35
|
-
static void UnrefGBytes(char* data, void* hint);
|
|
36
|
-
|
|
37
|
-
Session::Session(FridaSession* handle, Runtime* runtime)
|
|
38
|
-
: GLibObject(handle, runtime) {
|
|
39
|
-
g_object_ref(handle_);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Session::~Session() {
|
|
43
|
-
frida_unref(handle_);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
void Session::Init(Local<Object> exports, Runtime* runtime) {
|
|
47
|
-
auto isolate = Isolate::GetCurrent();
|
|
48
|
-
|
|
49
|
-
auto name = Nan::New("Session").ToLocalChecked();
|
|
50
|
-
auto tpl = CreateTemplate(name, Session::New, runtime);
|
|
51
|
-
|
|
52
|
-
auto instance_tpl = tpl->InstanceTemplate();
|
|
53
|
-
auto data = Local<Value>();
|
|
54
|
-
Nan::SetAccessor(instance_tpl, Nan::New("isDetached").ToLocalChecked(),
|
|
55
|
-
IsDetached, 0, data, DEFAULT, ReadOnly);
|
|
56
|
-
Nan::SetAccessor(instance_tpl, Nan::New("persistTimeout").ToLocalChecked(),
|
|
57
|
-
GetPersistTimeout, 0, data, DEFAULT, ReadOnly);
|
|
58
|
-
Nan::SetAccessor(instance_tpl, Nan::New("pid").ToLocalChecked(), GetPid, 0,
|
|
59
|
-
data, DEFAULT, ReadOnly);
|
|
60
|
-
|
|
61
|
-
Nan::SetPrototypeMethod(tpl, "detach", Detach);
|
|
62
|
-
Nan::SetPrototypeMethod(tpl, "resume", Resume);
|
|
63
|
-
Nan::SetPrototypeMethod(tpl, "enableChildGating", EnableChildGating);
|
|
64
|
-
Nan::SetPrototypeMethod(tpl, "disableChildGating", DisableChildGating);
|
|
65
|
-
Nan::SetPrototypeMethod(tpl, "createScript", CreateScript);
|
|
66
|
-
Nan::SetPrototypeMethod(tpl, "createScriptFromBytes", CreateScriptFromBytes);
|
|
67
|
-
Nan::SetPrototypeMethod(tpl, "compileScript", CompileScript);
|
|
68
|
-
Nan::SetPrototypeMethod(tpl, "snapshotScript", SnapshotScript);
|
|
69
|
-
Nan::SetPrototypeMethod(tpl, "setupPeerConnection", SetupPeerConnection);
|
|
70
|
-
Nan::SetPrototypeMethod(tpl, "joinPortal", JoinPortal);
|
|
71
|
-
|
|
72
|
-
auto ctor = Nan::GetFunction(tpl).ToLocalChecked();
|
|
73
|
-
Nan::Set(exports, name, ctor);
|
|
74
|
-
runtime->SetDataPointer(SESSION_DATA_CONSTRUCTOR,
|
|
75
|
-
new Persistent<Function>(isolate, ctor));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
Local<Object> Session::New(gpointer handle, Runtime* runtime) {
|
|
79
|
-
auto ctor = Nan::New<Function>(
|
|
80
|
-
*static_cast<Persistent<Function>*>(
|
|
81
|
-
runtime->GetDataPointer(SESSION_DATA_CONSTRUCTOR)));
|
|
82
|
-
const int argc = 1;
|
|
83
|
-
Local<Value> argv[argc] = { Nan::New<External>(handle) };
|
|
84
|
-
return Nan::NewInstance(ctor, argc, argv).ToLocalChecked();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
NAN_METHOD(Session::New) {
|
|
88
|
-
if (!info.IsConstructCall()) {
|
|
89
|
-
Nan::ThrowError("Use the `new` keyword to create a new instance");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (info.Length() != 1 || !info[0]->IsExternal()) {
|
|
94
|
-
Nan::ThrowTypeError("Bad argument, expected raw handle");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
auto runtime = GetRuntimeFromConstructorArgs(info);
|
|
99
|
-
|
|
100
|
-
auto handle = static_cast<FridaSession*>(
|
|
101
|
-
Local<External>::Cast(info[0])->Value());
|
|
102
|
-
auto wrapper = new Session(handle, runtime);
|
|
103
|
-
auto obj = info.This();
|
|
104
|
-
wrapper->Wrap(obj);
|
|
105
|
-
Nan::Set(obj, Nan::New("signals").ToLocalChecked(),
|
|
106
|
-
Signals::New(handle, runtime, TransformSignal, runtime));
|
|
107
|
-
|
|
108
|
-
info.GetReturnValue().Set(obj);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
NAN_PROPERTY_GETTER(Session::GetPid) {
|
|
112
|
-
auto handle = ObjectWrap::Unwrap<Session>(
|
|
113
|
-
info.Holder())->GetHandle<FridaSession>();
|
|
114
|
-
|
|
115
|
-
info.GetReturnValue().Set(Nan::New<Uint32>(
|
|
116
|
-
frida_session_get_pid(handle)));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
NAN_PROPERTY_GETTER(Session::GetPersistTimeout) {
|
|
120
|
-
auto handle = ObjectWrap::Unwrap<Session>(
|
|
121
|
-
info.Holder())->GetHandle<FridaSession>();
|
|
122
|
-
|
|
123
|
-
info.GetReturnValue().Set(Nan::New<Uint32>(
|
|
124
|
-
frida_session_get_persist_timeout(handle)));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
NAN_PROPERTY_GETTER(Session::IsDetached) {
|
|
128
|
-
auto handle = ObjectWrap::Unwrap<Session>(
|
|
129
|
-
info.Holder())->GetHandle<FridaSession>();
|
|
130
|
-
|
|
131
|
-
info.GetReturnValue().Set(
|
|
132
|
-
Nan::New(static_cast<bool>(frida_session_is_detached(handle))));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
namespace {
|
|
136
|
-
|
|
137
|
-
class DetachOperation : public Operation<FridaSession> {
|
|
138
|
-
protected:
|
|
139
|
-
void Begin() {
|
|
140
|
-
frida_session_detach(handle_, cancellable_, OnReady, this);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
void End(GAsyncResult* result, GError** error) {
|
|
144
|
-
frida_session_detach_finish(handle_, result, error);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
Local<Value> Result(Isolate* isolate) {
|
|
148
|
-
return Nan::Undefined();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
NAN_METHOD(Session::Detach) {
|
|
155
|
-
auto isolate = info.GetIsolate();
|
|
156
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
157
|
-
|
|
158
|
-
auto operation = new DetachOperation();
|
|
159
|
-
operation->Schedule(isolate, wrapper, info);
|
|
160
|
-
|
|
161
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
namespace {
|
|
165
|
-
|
|
166
|
-
class ResumeOperation : public Operation<FridaSession> {
|
|
167
|
-
protected:
|
|
168
|
-
void Begin() {
|
|
169
|
-
frida_session_resume(handle_, cancellable_, OnReady, this);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
void End(GAsyncResult* result, GError** error) {
|
|
173
|
-
frida_session_resume_finish(handle_, result, error);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
Local<Value> Result(Isolate* isolate) {
|
|
177
|
-
return Nan::Undefined();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
NAN_METHOD(Session::Resume) {
|
|
184
|
-
auto isolate = info.GetIsolate();
|
|
185
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
186
|
-
|
|
187
|
-
auto operation = new ResumeOperation();
|
|
188
|
-
operation->Schedule(isolate, wrapper, info);
|
|
189
|
-
|
|
190
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
namespace {
|
|
194
|
-
|
|
195
|
-
class EnableChildGatingOperation : public Operation<FridaSession> {
|
|
196
|
-
protected:
|
|
197
|
-
void Begin() {
|
|
198
|
-
frida_session_enable_child_gating(handle_, cancellable_, OnReady, this);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
void End(GAsyncResult* result, GError** error) {
|
|
202
|
-
frida_session_enable_child_gating_finish(handle_, result, error);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
Local<Value> Result(Isolate* isolate) {
|
|
206
|
-
return Nan::Undefined();
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
NAN_METHOD(Session::EnableChildGating) {
|
|
213
|
-
auto isolate = info.GetIsolate();
|
|
214
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
215
|
-
|
|
216
|
-
auto operation = new EnableChildGatingOperation();
|
|
217
|
-
operation->Schedule(isolate, wrapper, info);
|
|
218
|
-
|
|
219
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
namespace {
|
|
223
|
-
|
|
224
|
-
class DisableChildGatingOperation : public Operation<FridaSession> {
|
|
225
|
-
protected:
|
|
226
|
-
void Begin() {
|
|
227
|
-
frida_session_disable_child_gating(handle_, cancellable_, OnReady, this);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
void End(GAsyncResult* result, GError** error) {
|
|
231
|
-
frida_session_disable_child_gating_finish(handle_, result, error);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
Local<Value> Result(Isolate* isolate) {
|
|
235
|
-
return Nan::Undefined();
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
NAN_METHOD(Session::DisableChildGating) {
|
|
242
|
-
auto isolate = info.GetIsolate();
|
|
243
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
244
|
-
|
|
245
|
-
auto operation = new DisableChildGatingOperation();
|
|
246
|
-
operation->Schedule(isolate, wrapper, info);
|
|
247
|
-
|
|
248
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
namespace {
|
|
252
|
-
|
|
253
|
-
class CreateScriptOperation : public Operation<FridaSession> {
|
|
254
|
-
public:
|
|
255
|
-
CreateScriptOperation(gchar* source, FridaScriptOptions* options)
|
|
256
|
-
: source_(source),
|
|
257
|
-
options_(options) {
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
~CreateScriptOperation() {
|
|
261
|
-
g_object_unref(options_);
|
|
262
|
-
g_free(source_);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
protected:
|
|
266
|
-
void Begin() {
|
|
267
|
-
frida_session_create_script(handle_, source_, options_, cancellable_,
|
|
268
|
-
OnReady, this);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
void End(GAsyncResult* result, GError** error) {
|
|
272
|
-
script_ = frida_session_create_script_finish(handle_, result, error);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
Local<Value> Result(Isolate* isolate) {
|
|
276
|
-
auto wrapper = Script::New(script_, runtime_);
|
|
277
|
-
g_object_unref(script_);
|
|
278
|
-
return wrapper;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
private:
|
|
282
|
-
gchar* source_;
|
|
283
|
-
FridaScriptOptions* options_;
|
|
284
|
-
FridaScript* script_;
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
NAN_METHOD(Session::CreateScript) {
|
|
291
|
-
auto isolate = info.GetIsolate();
|
|
292
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
293
|
-
|
|
294
|
-
if (info.Length() < 4) {
|
|
295
|
-
Nan::ThrowTypeError("Missing one or more arguments");
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
auto source_value = info[0];
|
|
300
|
-
auto name_value = info[1];
|
|
301
|
-
auto snapshot_value = info[2];
|
|
302
|
-
auto runtime_value = info[3];
|
|
303
|
-
|
|
304
|
-
bool valid = true;
|
|
305
|
-
|
|
306
|
-
gchar* source;
|
|
307
|
-
Nan::Utf8String val(source_value);
|
|
308
|
-
source = g_strdup(*val);
|
|
309
|
-
if (source == NULL) {
|
|
310
|
-
Nan::ThrowTypeError("Bad argument, 'source' must be a string");
|
|
311
|
-
valid = false;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
FridaScriptOptions* options = NULL;
|
|
315
|
-
if (valid) {
|
|
316
|
-
options = ParseScriptOptions(name_value, snapshot_value, runtime_value);
|
|
317
|
-
valid = options != NULL;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (!valid) {
|
|
321
|
-
g_free(source);
|
|
322
|
-
g_clear_object(&options);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
auto operation = new CreateScriptOperation(source, options);
|
|
327
|
-
operation->Schedule(isolate, wrapper, info);
|
|
328
|
-
|
|
329
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
namespace {
|
|
333
|
-
|
|
334
|
-
class CreateScriptFromBytesOperation : public Operation<FridaSession> {
|
|
335
|
-
public:
|
|
336
|
-
CreateScriptFromBytesOperation(GBytes* bytes, FridaScriptOptions* options)
|
|
337
|
-
: bytes_(bytes),
|
|
338
|
-
options_(options) {
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
~CreateScriptFromBytesOperation() {
|
|
342
|
-
g_object_unref(options_);
|
|
343
|
-
g_bytes_unref(bytes_);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
protected:
|
|
347
|
-
void Begin() {
|
|
348
|
-
frida_session_create_script_from_bytes(handle_, bytes_, options_,
|
|
349
|
-
cancellable_, OnReady, this);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
void End(GAsyncResult* result, GError** error) {
|
|
353
|
-
script_ = frida_session_create_script_from_bytes_finish(handle_, result,
|
|
354
|
-
error);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
Local<Value> Result(Isolate* isolate) {
|
|
358
|
-
auto wrapper = Script::New(script_, runtime_);
|
|
359
|
-
g_object_unref(script_);
|
|
360
|
-
return wrapper;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
private:
|
|
364
|
-
GBytes* bytes_;
|
|
365
|
-
FridaScriptOptions* options_;
|
|
366
|
-
FridaScript* script_;
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
NAN_METHOD(Session::CreateScriptFromBytes) {
|
|
372
|
-
auto isolate = info.GetIsolate();
|
|
373
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
374
|
-
|
|
375
|
-
if (info.Length() < 4) {
|
|
376
|
-
Nan::ThrowTypeError("Missing one or more arguments");
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
auto bytes_value = info[0];
|
|
381
|
-
auto name_value = info[1];
|
|
382
|
-
auto snapshot_value = info[2];
|
|
383
|
-
auto runtime_value = info[3];
|
|
384
|
-
|
|
385
|
-
bool valid = true;
|
|
386
|
-
|
|
387
|
-
GBytes* bytes = NULL;
|
|
388
|
-
if (node::Buffer::HasInstance(bytes_value)) {
|
|
389
|
-
bytes = g_bytes_new(node::Buffer::Data(bytes_value),
|
|
390
|
-
node::Buffer::Length(bytes_value));
|
|
391
|
-
} else {
|
|
392
|
-
Nan::ThrowTypeError("Bad argument, 'bytes' must be a Buffer");
|
|
393
|
-
valid = false;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
FridaScriptOptions* options = NULL;
|
|
397
|
-
if (valid) {
|
|
398
|
-
options = ParseScriptOptions(name_value, snapshot_value, runtime_value);
|
|
399
|
-
valid = options != NULL;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (!valid) {
|
|
403
|
-
g_bytes_unref(bytes);
|
|
404
|
-
g_clear_object(&options);
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
auto operation = new CreateScriptFromBytesOperation(bytes, options);
|
|
409
|
-
operation->Schedule(isolate, wrapper, info);
|
|
410
|
-
|
|
411
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
namespace {
|
|
415
|
-
|
|
416
|
-
class CompileScriptOperation : public Operation<FridaSession> {
|
|
417
|
-
public:
|
|
418
|
-
CompileScriptOperation(gchar* source, FridaScriptOptions* options)
|
|
419
|
-
: source_(source),
|
|
420
|
-
options_(options) {
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
~CompileScriptOperation() {
|
|
424
|
-
g_object_unref(options_);
|
|
425
|
-
g_free(source_);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
protected:
|
|
429
|
-
void Begin() {
|
|
430
|
-
frida_session_compile_script(handle_, source_, options_, cancellable_,
|
|
431
|
-
OnReady, this);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
void End(GAsyncResult* result, GError** error) {
|
|
435
|
-
bytes_ = frida_session_compile_script_finish(handle_, result, error);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
Local<Value> Result(Isolate* isolate) {
|
|
439
|
-
gsize size;
|
|
440
|
-
auto data = g_bytes_get_data(bytes_, &size);
|
|
441
|
-
return Nan::NewBuffer(static_cast<char*>(const_cast<void*>(data)), size,
|
|
442
|
-
UnrefGBytes, bytes_).ToLocalChecked();
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
private:
|
|
446
|
-
gchar* source_;
|
|
447
|
-
FridaScriptOptions* options_;
|
|
448
|
-
GBytes* bytes_;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
NAN_METHOD(Session::CompileScript) {
|
|
454
|
-
auto isolate = info.GetIsolate();
|
|
455
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
456
|
-
|
|
457
|
-
if (info.Length() < 3) {
|
|
458
|
-
Nan::ThrowTypeError("Missing one or more arguments");
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
auto source_value = info[0];
|
|
463
|
-
auto name_value = info[1];
|
|
464
|
-
auto runtime_value = info[2];
|
|
465
|
-
|
|
466
|
-
bool valid = true;
|
|
467
|
-
|
|
468
|
-
gchar* source;
|
|
469
|
-
Nan::Utf8String val(source_value);
|
|
470
|
-
source = g_strdup(*val);
|
|
471
|
-
if (source == NULL) {
|
|
472
|
-
Nan::ThrowTypeError("Bad argument, 'source' must be a string");
|
|
473
|
-
valid = false;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
FridaScriptOptions* options = NULL;
|
|
477
|
-
if (valid) {
|
|
478
|
-
options = ParseScriptOptions(name_value, Nan::Null(), runtime_value);
|
|
479
|
-
valid = options != NULL;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
if (!valid) {
|
|
483
|
-
g_free(source);
|
|
484
|
-
g_clear_object(&options);
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
auto operation = new CompileScriptOperation(source, options);
|
|
489
|
-
operation->Schedule(isolate, wrapper, info);
|
|
490
|
-
|
|
491
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
static FridaScriptOptions* ParseScriptOptions(Local<Value> name_value,
|
|
495
|
-
Local<Value> snapshot_value, Local<Value> runtime_value) {
|
|
496
|
-
auto options = frida_script_options_new();
|
|
497
|
-
bool valid = true;
|
|
498
|
-
|
|
499
|
-
if (!name_value->IsNull()) {
|
|
500
|
-
Nan::Utf8String val(name_value);
|
|
501
|
-
const gchar* name = *val;
|
|
502
|
-
if (name != NULL) {
|
|
503
|
-
frida_script_options_set_name(options, name);
|
|
504
|
-
} else {
|
|
505
|
-
Nan::ThrowTypeError("Bad argument, 'name' must be a string");
|
|
506
|
-
valid = false;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (valid && !snapshot_value->IsNull()) {
|
|
511
|
-
if (node::Buffer::HasInstance(snapshot_value)) {
|
|
512
|
-
auto snapshot = g_bytes_new(node::Buffer::Data(snapshot_value),
|
|
513
|
-
node::Buffer::Length(snapshot_value));
|
|
514
|
-
frida_script_options_set_snapshot(options, snapshot);
|
|
515
|
-
g_bytes_unref(snapshot);
|
|
516
|
-
} else {
|
|
517
|
-
Nan::ThrowTypeError("Bad argument, 'snapshot' must be a Buffer");
|
|
518
|
-
valid = false;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (valid && !runtime_value->IsNull()) {
|
|
523
|
-
FridaScriptRuntime runtime;
|
|
524
|
-
valid = Runtime::ValueToEnum(runtime_value, FRIDA_TYPE_SCRIPT_RUNTIME,
|
|
525
|
-
&runtime);
|
|
526
|
-
if (valid) {
|
|
527
|
-
frida_script_options_set_runtime(options, runtime);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (!valid) {
|
|
532
|
-
g_object_unref(options);
|
|
533
|
-
return NULL;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
return options;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
namespace {
|
|
540
|
-
|
|
541
|
-
class SnapshotScriptOperation : public Operation<FridaSession> {
|
|
542
|
-
public:
|
|
543
|
-
SnapshotScriptOperation(gchar* embed_script, FridaSnapshotOptions* options)
|
|
544
|
-
: embed_script_(embed_script),
|
|
545
|
-
options_(options) {
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
~SnapshotScriptOperation() {
|
|
549
|
-
g_object_unref(options_);
|
|
550
|
-
g_free(embed_script_);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
protected:
|
|
554
|
-
void Begin() {
|
|
555
|
-
frida_session_snapshot_script(handle_, embed_script_, options_,
|
|
556
|
-
cancellable_, OnReady, this);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
void End(GAsyncResult* result, GError** error) {
|
|
560
|
-
bytes_ = frida_session_snapshot_script_finish(handle_, result, error);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
Local<Value> Result(Isolate* isolate) {
|
|
564
|
-
gsize size;
|
|
565
|
-
auto data = g_bytes_get_data(bytes_, &size);
|
|
566
|
-
return Nan::NewBuffer(static_cast<char*>(const_cast<void*>(data)), size,
|
|
567
|
-
UnrefGBytes, bytes_).ToLocalChecked();
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
private:
|
|
571
|
-
gchar* embed_script_;
|
|
572
|
-
FridaSnapshotOptions* options_;
|
|
573
|
-
GBytes* bytes_;
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
NAN_METHOD(Session::SnapshotScript) {
|
|
579
|
-
auto isolate = info.GetIsolate();
|
|
580
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
581
|
-
|
|
582
|
-
if (info.Length() < 3) {
|
|
583
|
-
Nan::ThrowTypeError("Missing one or more arguments");
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
auto embed_script_value = info[0];
|
|
588
|
-
auto warmup_script_value = info[1];
|
|
589
|
-
auto runtime_value = info[2];
|
|
590
|
-
|
|
591
|
-
bool valid = true;
|
|
592
|
-
|
|
593
|
-
gchar* embed_script;
|
|
594
|
-
Nan::Utf8String val(embed_script_value);
|
|
595
|
-
embed_script = g_strdup(*val);
|
|
596
|
-
if (embed_script == NULL) {
|
|
597
|
-
Nan::ThrowTypeError("Bad argument, 'embedScript' must be a string");
|
|
598
|
-
valid = false;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
FridaSnapshotOptions* options = NULL;
|
|
602
|
-
if (valid) {
|
|
603
|
-
options = ParseSnapshotOptions(warmup_script_value, runtime_value);
|
|
604
|
-
valid = options != NULL;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
if (!valid) {
|
|
608
|
-
g_free(embed_script);
|
|
609
|
-
g_clear_object(&options);
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
auto operation = new SnapshotScriptOperation(embed_script, options);
|
|
614
|
-
operation->Schedule(isolate, wrapper, info);
|
|
615
|
-
|
|
616
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
static FridaSnapshotOptions* ParseSnapshotOptions(
|
|
620
|
-
Local<Value> warmup_script_value, Local<Value> runtime_value) {
|
|
621
|
-
auto options = frida_snapshot_options_new();
|
|
622
|
-
bool valid = true;
|
|
623
|
-
|
|
624
|
-
if (!warmup_script_value->IsNull()) {
|
|
625
|
-
Nan::Utf8String val(warmup_script_value);
|
|
626
|
-
const gchar* warmup_script = *val;
|
|
627
|
-
if (warmup_script != NULL) {
|
|
628
|
-
frida_snapshot_options_set_warmup_script(options, warmup_script);
|
|
629
|
-
} else {
|
|
630
|
-
Nan::ThrowTypeError("Bad argument, 'warmupScript' must be a string");
|
|
631
|
-
valid = false;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
if (valid && !runtime_value->IsNull()) {
|
|
636
|
-
FridaScriptRuntime runtime;
|
|
637
|
-
valid = Runtime::ValueToEnum(runtime_value, FRIDA_TYPE_SCRIPT_RUNTIME,
|
|
638
|
-
&runtime);
|
|
639
|
-
if (valid) {
|
|
640
|
-
frida_snapshot_options_set_runtime(options, runtime);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
if (!valid) {
|
|
645
|
-
g_object_unref(options);
|
|
646
|
-
return NULL;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
return options;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
namespace {
|
|
653
|
-
|
|
654
|
-
class SetupPeerConnectionOperation : public Operation<FridaSession> {
|
|
655
|
-
public:
|
|
656
|
-
SetupPeerConnectionOperation(FridaPeerOptions* options) : options_(options) {
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
~SetupPeerConnectionOperation() {
|
|
660
|
-
g_object_unref(options_);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
protected:
|
|
664
|
-
void Begin() {
|
|
665
|
-
frida_session_setup_peer_connection(handle_, options_, cancellable_,
|
|
666
|
-
OnReady, this);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
void End(GAsyncResult* result, GError** error) {
|
|
670
|
-
frida_session_setup_peer_connection_finish(handle_, result, error);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
Local<Value> Result(Isolate* isolate) {
|
|
674
|
-
return Nan::Undefined();
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
private:
|
|
678
|
-
FridaPeerOptions* options_;
|
|
679
|
-
};
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
NAN_METHOD(Session::SetupPeerConnection) {
|
|
684
|
-
auto isolate = info.GetIsolate();
|
|
685
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
686
|
-
|
|
687
|
-
if (info.Length() < 2) {
|
|
688
|
-
Nan::ThrowTypeError("Missing one or more arguments");
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
auto stun_server_value = info[0];
|
|
693
|
-
auto relays_value = info[1];
|
|
694
|
-
|
|
695
|
-
auto options = frida_peer_options_new();
|
|
696
|
-
bool valid = true;
|
|
697
|
-
|
|
698
|
-
if (!stun_server_value->IsNull()) {
|
|
699
|
-
if (stun_server_value->IsString()) {
|
|
700
|
-
Nan::Utf8String stun_server(stun_server_value);
|
|
701
|
-
frida_peer_options_set_stun_server(options, *stun_server);
|
|
702
|
-
} else {
|
|
703
|
-
Nan::ThrowTypeError("Bad argument, 'stunServer' must be a string");
|
|
704
|
-
valid = false;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
if (valid) {
|
|
709
|
-
if (relays_value->IsArray()) {
|
|
710
|
-
auto array = Local<Array>::Cast(relays_value);
|
|
711
|
-
|
|
712
|
-
uint32_t n = array->Length();
|
|
713
|
-
|
|
714
|
-
for (uint32_t i = 0; i != n; i++) {
|
|
715
|
-
auto element_value = Nan::Get(array, i).ToLocalChecked();
|
|
716
|
-
FridaRelay* relay = Relay::TryParse(element_value, wrapper->runtime_);
|
|
717
|
-
if (relay == NULL) {
|
|
718
|
-
Nan::ThrowTypeError("Bad argument, 'relays' element type mismatch");
|
|
719
|
-
valid = false;
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
frida_peer_options_add_relay(options, relay);
|
|
723
|
-
}
|
|
724
|
-
} else {
|
|
725
|
-
Nan::ThrowTypeError("Bad argument, 'relays' must be an array");
|
|
726
|
-
valid = false;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
if (!valid) {
|
|
731
|
-
g_object_unref(options);
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
auto operation = new SetupPeerConnectionOperation(options);
|
|
736
|
-
operation->Schedule(isolate, wrapper, info);
|
|
737
|
-
|
|
738
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
namespace {
|
|
742
|
-
|
|
743
|
-
class JoinPortalOperation : public Operation<FridaSession> {
|
|
744
|
-
public:
|
|
745
|
-
JoinPortalOperation(gchar* address, FridaPortalOptions* options)
|
|
746
|
-
: address_(address),
|
|
747
|
-
options_(options) {
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
~JoinPortalOperation() {
|
|
751
|
-
g_object_unref(options_);
|
|
752
|
-
g_free(address_);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
protected:
|
|
756
|
-
void Begin() {
|
|
757
|
-
frida_session_join_portal(handle_, address_, options_, cancellable_,
|
|
758
|
-
OnReady, this);
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
void End(GAsyncResult* result, GError** error) {
|
|
762
|
-
membership_ = frida_session_join_portal_finish(handle_, result, error);
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
Local<Value> Result(Isolate* isolate) {
|
|
766
|
-
auto wrapper = PortalMembership::New(membership_, runtime_);
|
|
767
|
-
g_object_unref(membership_);
|
|
768
|
-
return wrapper;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
private:
|
|
772
|
-
gchar* address_;
|
|
773
|
-
FridaPortalOptions* options_;
|
|
774
|
-
FridaPortalMembership* membership_;
|
|
775
|
-
};
|
|
776
|
-
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
NAN_METHOD(Session::JoinPortal) {
|
|
780
|
-
auto isolate = info.GetIsolate();
|
|
781
|
-
auto wrapper = ObjectWrap::Unwrap<Session>(info.Holder());
|
|
782
|
-
|
|
783
|
-
if (info.Length() < 4) {
|
|
784
|
-
Nan::ThrowTypeError("Missing one or more arguments");
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
auto address_value = info[0];
|
|
789
|
-
auto certificate_value = info[1];
|
|
790
|
-
auto token_value = info[2];
|
|
791
|
-
auto acl_value = info[3];
|
|
792
|
-
|
|
793
|
-
if (!address_value->IsString()) {
|
|
794
|
-
Nan::ThrowTypeError("Bad argument, 'address' must be a string");
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
Nan::Utf8String address(address_value);
|
|
798
|
-
|
|
799
|
-
auto options = frida_portal_options_new();
|
|
800
|
-
bool valid = true;
|
|
801
|
-
|
|
802
|
-
if (!certificate_value->IsNull()) {
|
|
803
|
-
GTlsCertificate* certificate;
|
|
804
|
-
valid = Runtime::ValueToCertificate(certificate_value, &certificate);
|
|
805
|
-
if (valid) {
|
|
806
|
-
frida_portal_options_set_certificate(options, certificate);
|
|
807
|
-
g_object_unref(certificate);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
if (valid && !token_value->IsNull()) {
|
|
812
|
-
if (token_value->IsString()) {
|
|
813
|
-
Nan::Utf8String token(token_value);
|
|
814
|
-
frida_portal_options_set_token(options, *token);
|
|
815
|
-
} else {
|
|
816
|
-
Nan::ThrowTypeError("Bad argument, 'token' must be a string");
|
|
817
|
-
valid = false;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
if (valid && !acl_value->IsNull()) {
|
|
822
|
-
gchar** acl;
|
|
823
|
-
gint acl_length;
|
|
824
|
-
valid = Runtime::ValueToEnvp(acl_value, &acl, &acl_length);
|
|
825
|
-
if (valid) {
|
|
826
|
-
frida_portal_options_set_acl(options, acl, acl_length);
|
|
827
|
-
g_strfreev(acl);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
if (!valid) {
|
|
832
|
-
g_object_unref(options);
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
auto operation = new JoinPortalOperation(g_strdup(*address), options);
|
|
837
|
-
operation->Schedule(isolate, wrapper, info);
|
|
838
|
-
|
|
839
|
-
info.GetReturnValue().Set(operation->GetPromise(isolate));
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
Local<Value> Session::TransformSignal(const gchar* name, guint index,
|
|
843
|
-
const GValue* value, gpointer user_data) {
|
|
844
|
-
auto runtime = static_cast<Runtime*>(user_data);
|
|
845
|
-
|
|
846
|
-
if (index == 1 && strcmp(name, "detached") == 0) {
|
|
847
|
-
auto crash = g_value_get_object(value);
|
|
848
|
-
if (crash == NULL)
|
|
849
|
-
return Nan::Null();
|
|
850
|
-
return Crash::New(crash, runtime);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
return Local<Value>();
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
static void UnrefGBytes(char* data, void* hint) {
|
|
857
|
-
g_bytes_unref(static_cast<GBytes*>(hint));
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
}
|