frida 17.8.0 → 17.8.2
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/build/src/frida.js +15 -0
- package/build/src/frida_binding.d.ts +2 -0
- package/package.json +1 -1
- package/releng/deps.toml +1 -1
- package/releng/env_android.py +66 -5
- 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/customization.py +25 -0
- package/subprojects/frida-core.wrap +1 -1
package/build/src/frida.js
CHANGED
|
@@ -749,6 +749,21 @@ export const LogLevel = binding.LogLevel;
|
|
|
749
749
|
get isCancelled() {
|
|
750
750
|
return this._isCancelled();
|
|
751
751
|
}
|
|
752
|
+
static withTimeout(ms) {
|
|
753
|
+
const c = new Cancellable();
|
|
754
|
+
setTimeout(() => c.cancel(), ms).unref();
|
|
755
|
+
return c;
|
|
756
|
+
}
|
|
757
|
+
combine(other) {
|
|
758
|
+
const c = new Cancellable();
|
|
759
|
+
this.cancelled.connect(() => c.cancel());
|
|
760
|
+
other.cancelled.connect(() => c.cancel());
|
|
761
|
+
if (this.isCancelled)
|
|
762
|
+
c.cancel();
|
|
763
|
+
if (other.isCancelled)
|
|
764
|
+
c.cancel();
|
|
765
|
+
return c;
|
|
766
|
+
}
|
|
752
767
|
}
|
|
753
768
|
binding.Cancellable = Cancellable;
|
|
754
769
|
binding.IOStream.prototype[inspect.custom] = function (depth, options) {
|
|
@@ -550,6 +550,8 @@ export class BaseObject {
|
|
|
550
550
|
|
|
551
551
|
export class Cancellable extends _Cancellable {
|
|
552
552
|
readonly isCancelled: boolean;
|
|
553
|
+
static withTimeout(ms: number): Cancellable;
|
|
554
|
+
combine(other: Cancellable): Cancellable;
|
|
553
555
|
}
|
|
554
556
|
|
|
555
557
|
export class _Cancellable extends BaseObject {
|
package/package.json
CHANGED
package/releng/deps.toml
CHANGED
package/releng/env_android.py
CHANGED
|
@@ -41,9 +41,10 @@ def init_machine_config(machine: MachineSpec,
|
|
|
41
41
|
|
|
42
42
|
android_build_os = "darwin" if build_machine.os == "macos" else build_machine.os
|
|
43
43
|
android_build_arch = "x86_64" if build_machine.os in {"macos", "linux"} else build_machine.arch
|
|
44
|
-
android_api =
|
|
44
|
+
android_api = 21
|
|
45
45
|
|
|
46
46
|
llvm_bindir = ndk_root / "toolchains" / "llvm" / "prebuilt" / f"{android_build_os}-{android_build_arch}" / "bin"
|
|
47
|
+
libcxx_include_dir = llvm_bindir.parent / "sysroot" / "usr" / "include" / "c++" / "v1"
|
|
47
48
|
|
|
48
49
|
binaries = config["binaries"]
|
|
49
50
|
for (identifier, tool_name, *rest) in NDK_BINARIES:
|
|
@@ -80,14 +81,17 @@ def init_machine_config(machine: MachineSpec,
|
|
|
80
81
|
read_envflags = lambda name: shlex.split(environ.get(name, ""))
|
|
81
82
|
|
|
82
83
|
common_flags += ARCH_COMMON_FLAGS.get(machine.arch, [])
|
|
84
|
+
|
|
83
85
|
c_like_flags += ARCH_C_LIKE_FLAGS.get(machine.arch, [])
|
|
84
86
|
c_like_flags += read_envflags("CPPFLAGS")
|
|
87
|
+
|
|
88
|
+
if _needs_patched_fstream(machine, android_api):
|
|
89
|
+
overlay_dir = _generate_libcpp_overlay(libcxx_include_dir, outdir)
|
|
90
|
+
cxx_like_flags += ["-isystem", str(overlay_dir)]
|
|
91
|
+
|
|
85
92
|
linker_flags += ARCH_LINKER_FLAGS.get(machine.arch, [])
|
|
86
93
|
linker_flags += read_envflags("LDFLAGS")
|
|
87
94
|
|
|
88
|
-
if android_api < 24:
|
|
89
|
-
cxx_like_flags += ["-D_LIBCPP_HAS_NO_OFF_T_FUNCTIONS"]
|
|
90
|
-
|
|
91
95
|
constants = config["constants"]
|
|
92
96
|
constants["common_flags"] = strv_to_meson(common_flags)
|
|
93
97
|
constants["c_like_flags"] = strv_to_meson(c_like_flags)
|
|
@@ -103,6 +107,63 @@ def init_machine_config(machine: MachineSpec,
|
|
|
103
107
|
options["b_lundef"] = "true"
|
|
104
108
|
|
|
105
109
|
|
|
110
|
+
def _needs_patched_fstream(machine: MachineSpec, android_api: int) -> bool:
|
|
111
|
+
return machine.pointer_size == 4 and android_api < 24
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _generate_libcpp_overlay(libcxx_include_dir: Path, outdir: Path) -> Path:
|
|
115
|
+
src = libcxx_include_dir / "fstream"
|
|
116
|
+
if not src.exists():
|
|
117
|
+
raise FileNotFoundError(f"Missing libc++ header: {src}")
|
|
118
|
+
|
|
119
|
+
overlay_dir = outdir / "libcpp-overlay"
|
|
120
|
+
overlay_dir.mkdir(parents=True, exist_ok=True)
|
|
121
|
+
|
|
122
|
+
patched = src.read_text(encoding="utf-8")
|
|
123
|
+
patched = _patch_fstream_header(patched)
|
|
124
|
+
|
|
125
|
+
dst = overlay_dir / "fstream"
|
|
126
|
+
old_contents = dst.read_text(encoding="utf-8") if dst.exists() else None
|
|
127
|
+
if old_contents != patched:
|
|
128
|
+
dst.write_text(patched, encoding="utf-8")
|
|
129
|
+
|
|
130
|
+
return overlay_dir
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _patch_fstream_header(header: str) -> str:
|
|
134
|
+
old_fseek = """# elif defined(_NEWLIB_VERSION)
|
|
135
|
+
return fseek(__file, __offset, __whence);
|
|
136
|
+
# else
|
|
137
|
+
return ::fseeko(__file, __offset, __whence);
|
|
138
|
+
# endif"""
|
|
139
|
+
|
|
140
|
+
new_fseek = """# elif defined(_NEWLIB_VERSION) || (defined(__ANDROID__) && __SIZEOF_POINTER__ == 4 && __ANDROID_API__ < 24)
|
|
141
|
+
return fseek(__file, __offset, __whence);
|
|
142
|
+
# else
|
|
143
|
+
return ::fseeko(__file, __offset, __whence);
|
|
144
|
+
# endif"""
|
|
145
|
+
|
|
146
|
+
old_ftell = """# elif defined(_NEWLIB_VERSION)
|
|
147
|
+
return ftell(__file);
|
|
148
|
+
# else
|
|
149
|
+
return ftello(__file);
|
|
150
|
+
# endif"""
|
|
151
|
+
|
|
152
|
+
new_ftell = """# elif defined(_NEWLIB_VERSION) || (defined(__ANDROID__) && __SIZEOF_POINTER__ == 4 && __ANDROID_API__ < 24)
|
|
153
|
+
return ftell(__file);
|
|
154
|
+
# else
|
|
155
|
+
return ftello(__file);
|
|
156
|
+
# endif"""
|
|
157
|
+
|
|
158
|
+
result = header.replace(old_fseek, new_fseek)
|
|
159
|
+
result = result.replace(old_ftell, new_ftell)
|
|
160
|
+
|
|
161
|
+
if result == header:
|
|
162
|
+
raise ValueError("Failed to patch libc++ fstream header; expected patterns not found")
|
|
163
|
+
|
|
164
|
+
return result
|
|
165
|
+
|
|
166
|
+
|
|
106
167
|
class NdkNotFoundError(Exception):
|
|
107
168
|
pass
|
|
108
169
|
|
|
@@ -111,7 +172,7 @@ class NdkVersionError(Exception):
|
|
|
111
172
|
pass
|
|
112
173
|
|
|
113
174
|
|
|
114
|
-
NDK_REQUIRED =
|
|
175
|
+
NDK_REQUIRED = 29
|
|
115
176
|
|
|
116
177
|
NDK_BINARIES = [
|
|
117
178
|
("c", "clang"),
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -807,6 +807,31 @@ const assetRoot = params?.assetRoot ?? null;
|
|
|
807
807
|
get isCancelled(): boolean {
|
|
808
808
|
return this._isCancelled();
|
|
809
809
|
}
|
|
810
|
+
""",
|
|
811
|
+
),
|
|
812
|
+
CustomMethod(
|
|
813
|
+
typing="static withTimeout(ms: number): Cancellable",
|
|
814
|
+
code="""
|
|
815
|
+
static withTimeout(ms: number): Cancellable {
|
|
816
|
+
const c = new Cancellable();
|
|
817
|
+
setTimeout(() => c.cancel(), ms).unref();
|
|
818
|
+
return c;
|
|
819
|
+
}
|
|
820
|
+
""",
|
|
821
|
+
),
|
|
822
|
+
CustomMethod(
|
|
823
|
+
typing="combine(other: Cancellable): Cancellable",
|
|
824
|
+
code="""
|
|
825
|
+
combine(other: Cancellable): Cancellable {
|
|
826
|
+
const c = new Cancellable();
|
|
827
|
+
this.cancelled.connect(() => c.cancel());
|
|
828
|
+
other.cancelled.connect(() => c.cancel());
|
|
829
|
+
if (this.isCancelled)
|
|
830
|
+
c.cancel();
|
|
831
|
+
if (other.isCancelled)
|
|
832
|
+
c.cancel();
|
|
833
|
+
return c;
|
|
834
|
+
}
|
|
810
835
|
""",
|
|
811
836
|
),
|
|
812
837
|
],
|