frida 16.3.0 → 16.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/device.js +1 -4
- package/lib/device.ts +1 -4
- package/meson.build +7 -0
- package/package.json +1 -1
- package/scripts/package.py +45 -5
- package/src/addon.symbols +1 -0
- package/src/addon.version +4 -0
- package/src/device.cc +11 -3
- package/src/meson.build +16 -0
- package/src/runtime.cc +18 -4
- package/subprojects/frida-core.wrap +1 -1
package/dist/device.js
CHANGED
|
@@ -97,11 +97,8 @@ class Device {
|
|
|
97
97
|
return this.impl.spawn(program, argv, envp, env, cwd, stdio, aux, cancellable);
|
|
98
98
|
function consumeOption(name) {
|
|
99
99
|
const value = pendingOptions[name];
|
|
100
|
-
if (value === undefined) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
100
|
delete pendingOptions[name];
|
|
104
|
-
return value;
|
|
101
|
+
return value !== null && value !== void 0 ? value : null;
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
async input(target, data, cancellable) {
|
package/lib/device.ts
CHANGED
|
@@ -141,11 +141,8 @@ export class Device {
|
|
|
141
141
|
|
|
142
142
|
function consumeOption(name) {
|
|
143
143
|
const value = pendingOptions[name];
|
|
144
|
-
if (value === undefined) {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
144
|
delete pendingOptions[name];
|
|
148
|
-
return value;
|
|
145
|
+
return value ?? null;
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
148
|
|
package/meson.build
CHANGED
|
@@ -5,6 +5,9 @@ project('frida-node', 'cpp',
|
|
|
5
5
|
meson_version: '>=1.1.0',
|
|
6
6
|
)
|
|
7
7
|
|
|
8
|
+
cpp = meson.get_compiler('cpp')
|
|
9
|
+
strip = (cpp.get_argument_syntax() == 'msvc') ? '' : find_program('strip')
|
|
10
|
+
|
|
8
11
|
node = find_program('node')
|
|
9
12
|
npm = find_program('npm')
|
|
10
13
|
python = import('python').find_installation()
|
|
@@ -75,6 +78,7 @@ endforeach
|
|
|
75
78
|
|
|
76
79
|
extra_cpp_args = []
|
|
77
80
|
extra_link_args = []
|
|
81
|
+
extra_link_depends = []
|
|
78
82
|
|
|
79
83
|
foreach d : node_defines
|
|
80
84
|
extra_cpp_args += '-D' + d
|
|
@@ -125,6 +129,7 @@ binding = shared_module('frida_binding', frida_binding_sources,
|
|
|
125
129
|
'-DFRIDA_' + runtime.underscorify().to_upper(),
|
|
126
130
|
] + extra_cpp_args,
|
|
127
131
|
link_args: node_libs + extra_link_args,
|
|
132
|
+
link_depends: extra_link_depends,
|
|
128
133
|
dependencies: [frida_core_dep, nan_dep],
|
|
129
134
|
install: true,
|
|
130
135
|
install_dir: pkg_install_dir / 'build',
|
|
@@ -136,6 +141,8 @@ custom_target('prebuild',
|
|
|
136
141
|
command: [
|
|
137
142
|
python,
|
|
138
143
|
files('scripts' / 'package.py'),
|
|
144
|
+
'>>>', strip, '<<<',
|
|
145
|
+
get_option('strip').to_string(),
|
|
139
146
|
'@INPUT@',
|
|
140
147
|
'@OUTPUT@',
|
|
141
148
|
],
|
package/package.json
CHANGED
package/scripts/package.py
CHANGED
|
@@ -1,14 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
import subprocess
|
|
2
4
|
import sys
|
|
3
5
|
import tarfile
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Optional
|
|
4
8
|
|
|
5
9
|
|
|
6
10
|
def main(argv: list[str]):
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
args = argv[1:]
|
|
12
|
+
strip_command = pop_cmd_array_arg(args)
|
|
13
|
+
strip_enabled = args.pop(0) == "true"
|
|
14
|
+
binding = Path(args.pop(0))
|
|
15
|
+
outfile = Path(args.pop(0))
|
|
16
|
+
|
|
17
|
+
intermediate_path = outfile.parent / f"{outfile.name}.tmp"
|
|
18
|
+
shutil.copy(binding, intermediate_path)
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
if strip_enabled and strip_command is not None:
|
|
22
|
+
subprocess.run(
|
|
23
|
+
strip_command + [intermediate_path],
|
|
24
|
+
stdout=subprocess.PIPE,
|
|
25
|
+
stderr=subprocess.STDOUT,
|
|
26
|
+
encoding="utf-8",
|
|
27
|
+
check=True,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
with tarfile.open(outfile, "w:gz") as tar:
|
|
31
|
+
tar.add(intermediate_path, arcname="build/frida_binding.node")
|
|
32
|
+
except subprocess.CalledProcessError as e:
|
|
33
|
+
print(e, file=sys.stderr)
|
|
34
|
+
print("Output:\n\t| " + "\n\t| ".join(e.output.strip().split("\n")), file=sys.stderr)
|
|
35
|
+
sys.exit(1)
|
|
36
|
+
finally:
|
|
37
|
+
os.unlink(intermediate_path)
|
|
38
|
+
|
|
9
39
|
|
|
10
|
-
|
|
11
|
-
|
|
40
|
+
def pop_cmd_array_arg(args: list[str]) -> Optional[list[str]]:
|
|
41
|
+
result = []
|
|
42
|
+
first = args.pop(0)
|
|
43
|
+
assert first == ">>>"
|
|
44
|
+
while True:
|
|
45
|
+
cur = args.pop(0)
|
|
46
|
+
if cur == "<<<":
|
|
47
|
+
break
|
|
48
|
+
result.append(cur)
|
|
49
|
+
if len(result) == 1 and not result[0]:
|
|
50
|
+
return None
|
|
51
|
+
return result
|
|
12
52
|
|
|
13
53
|
|
|
14
54
|
if __name__ == "__main__":
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# No exported symbols.
|
package/src/device.cc
CHANGED
|
@@ -759,11 +759,19 @@ NAN_METHOD(Device::Spawn) {
|
|
|
759
759
|
for (uint32_t i = 0; i != n; i++) {
|
|
760
760
|
auto key = Nan::Get(keys, i).ToLocalChecked();
|
|
761
761
|
auto value = Nan::Get(object, key).ToLocalChecked();
|
|
762
|
+
if (value->IsUndefined()) {
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
762
765
|
|
|
763
|
-
Nan::Utf8String
|
|
766
|
+
Nan::Utf8String k(key);
|
|
764
767
|
|
|
765
|
-
|
|
766
|
-
|
|
768
|
+
auto v = Runtime::ValueToVariant(value);
|
|
769
|
+
if (v == NULL) {
|
|
770
|
+
valid = false;
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
g_hash_table_insert(aux, g_strdup(*k), g_variant_ref_sink(v));
|
|
767
775
|
}
|
|
768
776
|
} else {
|
|
769
777
|
Nan::ThrowTypeError("Bad argument, 'aux' must be an object");
|
package/src/meson.build
CHANGED
|
@@ -25,3 +25,19 @@ frida_binding_sources = files(
|
|
|
25
25
|
'glib_context.cc',
|
|
26
26
|
'win_delay_load_hook.cc',
|
|
27
27
|
)
|
|
28
|
+
|
|
29
|
+
if system == 'windows'
|
|
30
|
+
if cpp.get_argument_syntax() != 'msvc'
|
|
31
|
+
symfile = 'addon.symbols'
|
|
32
|
+
extra_link_args += '-Wl,--retain-symbols-file,' + meson.current_source_dir() / symfile
|
|
33
|
+
extra_link_depends += files(symfile)
|
|
34
|
+
endif
|
|
35
|
+
elif system == 'darwin'
|
|
36
|
+
symlist = 'addon.symbols'
|
|
37
|
+
extra_link_args += '-Wl,-exported_symbols_list,' + meson.current_source_dir() / symlist
|
|
38
|
+
extra_link_depends += files(symlist)
|
|
39
|
+
else
|
|
40
|
+
symscript = 'addon.version'
|
|
41
|
+
extra_link_args += '-Wl,--version-script,' + meson.current_source_dir() / symscript
|
|
42
|
+
extra_link_depends += files(symscript)
|
|
43
|
+
endif
|
package/src/runtime.cc
CHANGED
|
@@ -280,8 +280,12 @@ GVariant* Runtime::ValueToVariant(Local<Value> value) {
|
|
|
280
280
|
auto array = Local<Array>::Cast(value);
|
|
281
281
|
uint32_t n = array->Length();
|
|
282
282
|
for (uint32_t i = 0; i != n; i++) {
|
|
283
|
-
auto
|
|
284
|
-
|
|
283
|
+
auto v = ValueToVariant(Nan::Get(array, i).ToLocalChecked());
|
|
284
|
+
if (v == NULL) {
|
|
285
|
+
g_variant_builder_clear(&builder);
|
|
286
|
+
return NULL;
|
|
287
|
+
}
|
|
288
|
+
g_variant_builder_add(&builder, "v", v);
|
|
285
289
|
}
|
|
286
290
|
|
|
287
291
|
return g_variant_builder_end(&builder);
|
|
@@ -302,9 +306,19 @@ GVariant* Runtime::ValueToVariant(Local<Value> value) {
|
|
|
302
306
|
for (uint32_t i = 0; i != n; i++) {
|
|
303
307
|
auto key = Nan::Get(names, i).ToLocalChecked();
|
|
304
308
|
auto val = Nan::Get(object, key).ToLocalChecked();
|
|
309
|
+
if (val->IsUndefined()) {
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
Nan::Utf8String k(key);
|
|
314
|
+
|
|
315
|
+
auto v = ValueToVariant(val);
|
|
316
|
+
if (v == NULL) {
|
|
317
|
+
g_variant_builder_clear(&builder);
|
|
318
|
+
return NULL;
|
|
319
|
+
}
|
|
305
320
|
|
|
306
|
-
|
|
307
|
-
g_variant_builder_add(&builder, "{sv}", *key_str, ValueToVariant(val));
|
|
321
|
+
g_variant_builder_add(&builder, "{sv}", *k, v);
|
|
308
322
|
}
|
|
309
323
|
|
|
310
324
|
return g_variant_builder_end(&builder);
|