mirror of
https://github.com/frida/frida-core.git
synced 2026-11-09 01:59:34 -10:00
Compare commits
No files matched your search
@@ -0,0 +1 @@
|
||||
github: frida
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
include:
|
||||
- { id: windows-x86_64, runner: '"windows-latest"' }
|
||||
- { id: windows-x86, runner: '"windows-latest"' }
|
||||
- { id: macos-x86_64, runner: '"macos-11"' }
|
||||
- { id: macos-x86_64, runner: '"macos-latest"' }
|
||||
- { id: macos-arm64, runner: '"macos-latest"' }
|
||||
- { id: linux-x86_64, runner: '"ubuntu-latest"' }
|
||||
- { id: linux-x86, runner: '"ubuntu-latest"' }
|
||||
@@ -42,7 +42,9 @@ jobs:
|
||||
run: sudo security authorizationdb write system.privilege.taskport allow
|
||||
- name: Install gcc-multilib
|
||||
if: matrix.id == 'linux-x86'
|
||||
run: sudo apt-get install gcc-multilib lib32stdc++-11-dev
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-multilib lib32stdc++-13-dev
|
||||
- name: Build
|
||||
if: ${{ startsWith(matrix.id, 'windows-') }}
|
||||
run: |
|
||||
@@ -66,7 +68,6 @@ jobs:
|
||||
name: core-devkit-${{ matrix.id }}
|
||||
path: build/src/devkit/
|
||||
- name: Test
|
||||
if: matrix.id != 'macos-arm64'
|
||||
run: make test
|
||||
|
||||
cross:
|
||||
@@ -87,7 +88,9 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install toolchain
|
||||
run: sudo apt-get install ${{ matrix.pkg }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ${{ matrix.pkg }}
|
||||
- name: Build
|
||||
run: |
|
||||
./configure ${{ matrix.opts }} ${{ env.FRIDA_CORE_OPTIONS }}
|
||||
@@ -147,6 +150,14 @@ jobs:
|
||||
certificates-p12: ${{ secrets.APPLE_CERTIFICATES_P12 }}
|
||||
certificates-password: ${{ secrets.APPLE_CERTIFICATES_PASSWORD }}
|
||||
keychain-password: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
|
||||
- uses: nttld/setup-ndk@v1
|
||||
if: startsWith(matrix.id, 'android-')
|
||||
id: setup-ndk
|
||||
with:
|
||||
ndk-version: r25c
|
||||
- name: Add NDK to env
|
||||
if: startsWith(matrix.id, 'android-')
|
||||
run: echo ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }} >> $GITHUB_ENV
|
||||
- name: Build
|
||||
run: |
|
||||
./configure --host=${{ matrix.id }} ${{ env.FRIDA_CORE_OPTIONS }}
|
||||
@@ -177,6 +188,7 @@ jobs:
|
||||
tar -C /tmp/pkg -czf /tmp/runner.tar.gz .
|
||||
- name: Test on Corellium iOS device
|
||||
if: matrix.id == 'ios-arm64'
|
||||
continue-on-error: true
|
||||
uses: frida/corellium-action@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -192,6 +204,7 @@ jobs:
|
||||
./frida-tests
|
||||
- name: Test on Corellium Android device
|
||||
if: matrix.id == 'android-arm64'
|
||||
continue-on-error: true
|
||||
uses: frida/corellium-action@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -228,3 +241,67 @@ jobs:
|
||||
cp -a tests/frida-tests tests/labrats lib/agent/frida-agent.so /tmp/pkg/
|
||||
tar -C /tmp/pkg -cf /tmp/runner.tar .
|
||||
/opt/sabrelite/run.sh /tmp/runner.tar /opt/frida/frida-tests
|
||||
|
||||
# This job is used to check that the Linux helpers are built correctly for all
|
||||
# supported architectures. We do this because the binary artifacts are checked
|
||||
# in, and we want to ensure that they are up-to-date with respect to the source
|
||||
# for all architectures.
|
||||
check-linux-helpers:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86, x86_64, arm, armbe8, arm64, arm64be, arm64beilp32, mips, mipsel, mips64, mips64el]
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/frida/core-linux-helpers-${{ matrix.arch }}:latest
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build
|
||||
run: |
|
||||
./src/linux/helpers/rebuild.sh ${{ matrix.arch }}
|
||||
- name: Check for unexpected changes
|
||||
run: |
|
||||
git config --global --add safe.directory "$(realpath .)"
|
||||
status_output="$(git status --porcelain)"
|
||||
if [ -n "$status_output" ]; then
|
||||
echo "Unexpected changes detected:"
|
||||
echo "$status_output"
|
||||
echo "Diff:"
|
||||
git diff
|
||||
exit 1
|
||||
else
|
||||
echo "No unexpected changes detected."
|
||||
fi
|
||||
|
||||
# This job is used to check that the Linux labrats are built correctly for all
|
||||
# supported architectures. We do this because the binary artifacts are checked
|
||||
# in, and we want to ensure that they are up-to-date with respect to the source
|
||||
# for all architectures.
|
||||
check-labrats:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86, x86_64, arm, armbe8, arm64, arm64be, arm64beilp32, mips, mipsel, mips64, mips64el]
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/frida/core-linux-helpers-${{ matrix.arch }}:latest
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build
|
||||
run: |
|
||||
./tests/labrats/rebuild.sh ${{ matrix.arch }}
|
||||
- name: Check for unexpected changes
|
||||
run: |
|
||||
git config --global --add safe.directory "$(realpath .)"
|
||||
status_output="$(git status --porcelain)"
|
||||
if [ -n "$status_output" ]; then
|
||||
echo "Unexpected changes detected:"
|
||||
echo "$status_output"
|
||||
echo "Diff:"
|
||||
git diff
|
||||
exit 1
|
||||
else
|
||||
echo "No unexpected changes detected."
|
||||
fi
|
||||
@@ -3,9 +3,16 @@
|
||||
/src/barebone/helpers/memory-scanner/target/
|
||||
/src/barebone/helpers/target/
|
||||
/src/barebone/node_modules/
|
||||
/src/barebone/script-runtime.js
|
||||
/src/compiler/node_modules/
|
||||
/src/darwin/agent/osanalytics/node_modules/
|
||||
/src/darwin/agent/osanalytics/osanalytics.js
|
||||
/src/darwin/agent/reportcrash/node_modules/
|
||||
/src/darwin/agent/reportcrash/reportcrash.js
|
||||
/src/droidy/helper/build/
|
||||
/src/fruity/helpers/build/
|
||||
/src/linux/agent/system-server/node_modules/
|
||||
/src/linux/agent/system-server/system-server.js
|
||||
/src/linux/helpers/build/
|
||||
/src/linux/helpers/ext/
|
||||
/subprojects/*
|
||||
+55
-12
@@ -4,6 +4,7 @@ import base64
|
||||
from collections import OrderedDict
|
||||
from dataclasses import dataclass, field
|
||||
import itertools
|
||||
import locale
|
||||
import os
|
||||
from pathlib import Path
|
||||
import pickle
|
||||
@@ -14,7 +15,7 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import traceback
|
||||
from typing import Any, Literal, Mapping, Optional, Sequence
|
||||
from typing import Any, Literal, Mapping, Optional, Sequence, Tuple
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
@@ -140,16 +141,19 @@ def setup(role: Role,
|
||||
compat = set()
|
||||
else:
|
||||
summary = "enabled by user"
|
||||
missing: list[MissingFeature] = []
|
||||
|
||||
if "native" in compat:
|
||||
have_toolchain = True
|
||||
other_label: Optional[str] = None
|
||||
other_triplet: Optional[str] = None
|
||||
extra_environ: dict[str, str] = {}
|
||||
|
||||
if host_os == "windows" and host_arch == "x86_64" and host_config == "mingw":
|
||||
other_triplet = "i686-w64-mingw32"
|
||||
have_toolchain = shutil.which(other_triplet + "-gcc") is not None
|
||||
other_label = "x86"
|
||||
have_toolchain, other_triplet = detect_mingw_toolchain_for("x86")
|
||||
elif host_os == "linux" and host_arch == "x86_64" and host_config is None:
|
||||
other_label = "x86"
|
||||
other_triplet = "i686-linux-gnu"
|
||||
have_toolchain = shutil.which(other_triplet + "-gcc") is not None
|
||||
if not have_toolchain:
|
||||
@@ -173,7 +177,7 @@ def setup(role: Role,
|
||||
if not have_toolchain:
|
||||
if not auto_detect:
|
||||
raise ToolchainNotFoundError(f"unable to locate toolchain for {other_triplet}")
|
||||
summary = "disabled due to missing toolchain for {other_triplet}"
|
||||
missing.append(MissingFeature(other_label, other_triplet))
|
||||
|
||||
if host_os == "windows" and host_arch == "x86_64" and have_toolchain:
|
||||
group = OutputGroup("x86", other_triplet, extra_environ)
|
||||
@@ -269,6 +273,28 @@ def setup(role: Role,
|
||||
]
|
||||
|
||||
if "emulated" in compat:
|
||||
if host_os == "windows" and host_arch == "arm64":
|
||||
for kind, emulated_arch in [("modern", "x86_64"), ("legacy", "x86")]:
|
||||
if host_config == "mingw":
|
||||
found, emulated_triplet = detect_mingw_toolchain_for(emulated_arch)
|
||||
if not found:
|
||||
if not auto_detect:
|
||||
raise ToolchainNotFoundError(f"unable to locate toolchain for {emulated_triplet}")
|
||||
missing.append(MissingFeature(emulated_arch, emulated_triplet))
|
||||
continue
|
||||
else:
|
||||
emulated_triplet = None
|
||||
outputs[OutputGroup(emulated_arch, emulated_triplet, extra_environ)] = [
|
||||
Output(identifier=f"helper_emulated_{kind}",
|
||||
name=HELPER_FILE_WINDOWS.name.replace(".exe", f"-{emulated_arch}.exe"),
|
||||
file=HELPER_FILE_WINDOWS,
|
||||
target=HELPER_TARGET),
|
||||
Output(identifier=f"agent_emulated_{kind}",
|
||||
name=AGENT_FILE_WINDOWS.name.replace(".dll", f"-{emulated_arch}.dll"),
|
||||
file=AGENT_FILE_WINDOWS,
|
||||
target=AGENT_TARGET),
|
||||
]
|
||||
|
||||
if host_os == "android" and host_arch in {"x86_64", "x86"}:
|
||||
outputs[OutputGroup("arm")] = [
|
||||
Output(identifier="agent_emulated_legacy",
|
||||
@@ -290,6 +316,8 @@ def setup(role: Role,
|
||||
state = State(role, builddir, top_builddir, frida_version, host_os, host_config, allowed_prebuilds, outputs)
|
||||
serialized_state = base64.b64encode(pickle.dumps(state)).decode('ascii')
|
||||
|
||||
if missing:
|
||||
summary = ", ".join([f"{m.label} disabled due to missing toolchain for {m.triplet}" for m in missing])
|
||||
variable_names, output_names = zip(*[(output.identifier, output.name) \
|
||||
for output in itertools.chain.from_iterable(outputs.values())])
|
||||
print("ok")
|
||||
@@ -349,6 +377,12 @@ class Output:
|
||||
target: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class MissingFeature:
|
||||
label: str
|
||||
triplet: str
|
||||
|
||||
|
||||
def compile(privdir: Path, state: State):
|
||||
releng_location = query_releng_location(state.role)
|
||||
subprojects = detect_relevant_subprojects(releng_location)
|
||||
@@ -367,7 +401,7 @@ def compile(privdir: Path, state: State):
|
||||
**kwargs,
|
||||
"stdout": subprocess.PIPE,
|
||||
"stderr": subprocess.STDOUT,
|
||||
"encoding": "utf-8",
|
||||
"encoding": locale.getpreferredencoding(),
|
||||
}
|
||||
else:
|
||||
silenced_kwargs = kwargs
|
||||
@@ -432,7 +466,7 @@ def compile(privdir: Path, state: State):
|
||||
path = Path(raw_path)
|
||||
if not path.is_absolute():
|
||||
path = Path(os.path.relpath(workdir / path, top_builddir))
|
||||
input_entries.append(quote(path.as_posix()))
|
||||
input_entries.append(escape_depfile_path(path.as_posix()))
|
||||
depfile_lines.append(f"{output_relpath}: {' '.join(input_entries)}")
|
||||
|
||||
(state.builddir / DEPFILE_FILENAME).write_text("\n".join(depfile_lines), encoding="utf-8")
|
||||
@@ -523,10 +557,8 @@ def scrub_windows_devenv_dirs_from_path(raw_path: str, env: Mapping[str, str]) -
|
||||
return ";".join(clean_entries)
|
||||
|
||||
|
||||
def quote(path: str) -> str:
|
||||
if " " not in path:
|
||||
return path
|
||||
return "\"" + path.replace ("\"", "\\\"") + "\""
|
||||
def escape_depfile_path(path: str) -> str:
|
||||
return path.replace(" ", "\\ ")
|
||||
|
||||
|
||||
def query_releng_location(role: Role) -> Path:
|
||||
@@ -572,10 +604,10 @@ def grab_subprojects_from_parent(subprojects: dict[str, Path], releng_location:
|
||||
continue
|
||||
|
||||
try:
|
||||
subp_here.symlink_to(location, target_is_directory=True)
|
||||
subp_here.symlink_to(Path("..") / ".." / name, target_is_directory=True)
|
||||
continue
|
||||
except OSError as e:
|
||||
if not getattr(e, "winerror") == 1314:
|
||||
if not getattr(e, "winerror", None) == 1314:
|
||||
raise e
|
||||
|
||||
subprocess.run(["git", "worktree", "add", subp_here],
|
||||
@@ -591,6 +623,12 @@ def configure_import_path(releng_location: Path):
|
||||
sys.path.insert(0, str(releng_location.parent))
|
||||
|
||||
|
||||
def detect_mingw_toolchain_for(arch: str) -> Tuple[bool, Optional[str]]:
|
||||
triplet = MINGW_ARCHS.get(arch, arch) + "-w64-mingw32"
|
||||
found = shutil.which(triplet + "-gcc") is not None
|
||||
return (found, triplet)
|
||||
|
||||
|
||||
STATE_FILENAME = "state.dat"
|
||||
DEPFILE_FILENAME = "compat.deps"
|
||||
|
||||
@@ -618,6 +656,11 @@ MSVS_ENVVARS = {
|
||||
"LIB",
|
||||
}
|
||||
|
||||
MINGW_ARCHS = {
|
||||
"x86": "i686",
|
||||
"arm64": "aarch64",
|
||||
}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
@@ -1,6 +1,8 @@
|
||||
helper_modern = get_option('helper_modern')
|
||||
helper_legacy = get_option('helper_legacy')
|
||||
helper_compat = ''
|
||||
helper_emulated_modern = get_option('helper_emulated_modern')
|
||||
helper_emulated_legacy = get_option('helper_emulated_legacy')
|
||||
helper_depends = []
|
||||
|
||||
agent_modern = get_option('agent_modern')
|
||||
@@ -18,6 +20,7 @@ server_depends = []
|
||||
|
||||
no_overridden_compat_bits = \
|
||||
helper_modern == 'auto' and helper_legacy == 'auto' \
|
||||
and helper_emulated_modern == 'auto' and helper_emulated_legacy == 'auto' \
|
||||
and agent_modern == 'auto' and agent_legacy == 'auto' \
|
||||
and agent_emulated_modern == 'auto' and agent_emulated_legacy == 'auto'
|
||||
|
||||
|
||||
+63
-34
@@ -147,7 +147,7 @@ namespace Frida.Inject {
|
||||
public extern void init ();
|
||||
}
|
||||
|
||||
public class Application : Object {
|
||||
public sealed class Application : Object {
|
||||
public string? device_id {
|
||||
get;
|
||||
construct;
|
||||
@@ -388,7 +388,7 @@ namespace Frida.Inject {
|
||||
return false;
|
||||
}
|
||||
|
||||
script_runner.on_stdin (line);
|
||||
script_runner.on_stdin (line, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -414,14 +414,19 @@ namespace Frida.Inject {
|
||||
|
||||
buf[n] = 0;
|
||||
|
||||
script_runner.on_stdin ((string) buf);
|
||||
if (script_runner.terminal_mode == TerminalMode.BINARY) {
|
||||
var bytes = new Bytes (buf[:n]);
|
||||
script_runner.on_stdin ("", bytes);
|
||||
} else {
|
||||
script_runner.on_stdin ((string) buf, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private class ScriptRunner : Object, RpcPeer {
|
||||
private sealed class ScriptRunner : Object, RpcPeer {
|
||||
public TerminalMode terminal_mode {
|
||||
get;
|
||||
private set;
|
||||
@@ -549,7 +554,7 @@ namespace Frida.Inject {
|
||||
var stage = new Json.Node.alloc ().init_string ("early");
|
||||
|
||||
try {
|
||||
yield rpc_client.call ("init", new Json.Node[] { stage, parameters }, io_cancellable);
|
||||
yield rpc_client.call ("init", new Json.Node[] { stage, parameters }, null, io_cancellable);
|
||||
} catch (GLib.Error e) {
|
||||
}
|
||||
}
|
||||
@@ -591,7 +596,7 @@ namespace Frida.Inject {
|
||||
private async TerminalMode query_terminal_mode () {
|
||||
Json.Node mode_value;
|
||||
try {
|
||||
mode_value = yield rpc_client.call ("getFridaTerminalMode", new Json.Node[] {}, io_cancellable);
|
||||
mode_value = yield rpc_client.call ("getFridaTerminalMode", new Json.Node[] {}, null, io_cancellable);
|
||||
} catch (GLib.Error e) {
|
||||
return COOKED;
|
||||
}
|
||||
@@ -599,7 +604,14 @@ namespace Frida.Inject {
|
||||
if (mode_value.get_value_type () != typeof (string))
|
||||
return COOKED;
|
||||
|
||||
return (mode_value.get_string () == "raw") ? TerminalMode.RAW : TerminalMode.COOKED;
|
||||
switch (mode_value.get_string ()) {
|
||||
case "raw":
|
||||
return TerminalMode.RAW;
|
||||
case "binary":
|
||||
return TerminalMode.BINARY;
|
||||
default:
|
||||
return TerminalMode.COOKED;
|
||||
}
|
||||
}
|
||||
|
||||
private void apply_terminal_mode (TerminalMode mode) throws Error {
|
||||
@@ -632,10 +644,10 @@ namespace Frida.Inject {
|
||||
}
|
||||
#endif
|
||||
|
||||
public void on_stdin (string data) {
|
||||
var data_value = new Json.Node.alloc ().init_string (data);
|
||||
public void on_stdin (string str, Bytes? data) {
|
||||
var str_value = new Json.Node.alloc ().init_string (str);
|
||||
|
||||
rpc_client.call.begin ("onFridaStdin", new Json.Node[] { data_value }, io_cancellable);
|
||||
rpc_client.call.begin ("onFridaStdin", new Json.Node[] { str_value }, data, io_cancellable);
|
||||
}
|
||||
|
||||
private void on_script_file_changed (File file, File? other_file, FileMonitorEvent event_type) {
|
||||
@@ -675,7 +687,7 @@ namespace Frida.Inject {
|
||||
handled = try_handle_log_message (message);
|
||||
break;
|
||||
case "send":
|
||||
handled = try_handle_stdout_message (message);
|
||||
handled = try_handle_stdout_message (message, data);
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
@@ -722,20 +734,19 @@ namespace Frida.Inject {
|
||||
*
|
||||
* {"type":"send","payload":["frida:stdout","DATA"]}
|
||||
*/
|
||||
private bool try_handle_stdout_message (Json.Object message) {
|
||||
private bool try_handle_stdout_message (Json.Object message, Bytes? data) {
|
||||
var payload = message.get_member ("payload");
|
||||
if (payload.get_node_type () != Json.NodeType.ARRAY)
|
||||
return false;
|
||||
|
||||
var tuple = payload.get_array ();
|
||||
if (tuple.get_length () != 2)
|
||||
var tuple_len = tuple.get_length ();
|
||||
if (tuple_len == 0)
|
||||
return false;
|
||||
|
||||
var first_element = tuple.get_element (0);
|
||||
if (first_element.get_value_type () != typeof (string))
|
||||
var type = tuple.get_element (0).get_string ();
|
||||
if (type == null)
|
||||
return false;
|
||||
|
||||
var type = first_element.get_string ();
|
||||
switch (type) {
|
||||
case "frida:stdout":
|
||||
case "frida:stderr":
|
||||
@@ -744,31 +755,49 @@ namespace Frida.Inject {
|
||||
return false;
|
||||
}
|
||||
|
||||
var second_element = tuple.get_element (1);
|
||||
if (second_element.get_value_type () != typeof (string))
|
||||
return false;
|
||||
var str = second_element.get_string ();
|
||||
|
||||
switch (type) {
|
||||
case "frida:stdout":
|
||||
stdout.write (str.data);
|
||||
stdout.flush ();
|
||||
return true;
|
||||
case "frida:stderr":
|
||||
stderr.write (str.data);
|
||||
return true;
|
||||
default:
|
||||
if (tuple_len >= 2) {
|
||||
var str = tuple.get_element (1).get_string ();
|
||||
if (str == null)
|
||||
return false;
|
||||
|
||||
switch (type) {
|
||||
case "frida:stdout":
|
||||
stdout.write (str.data);
|
||||
stdout.flush ();
|
||||
break;
|
||||
case "frida:stderr":
|
||||
stderr.write (str.data);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (data != null) {
|
||||
switch (type) {
|
||||
case "frida:stdout":
|
||||
stdout.write (data.get_data ());
|
||||
stdout.flush ();
|
||||
break;
|
||||
case "frida:stderr":
|
||||
stderr.write (data.get_data ());
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async void post_rpc_message (string json, Cancellable? cancellable) throws Error, IOError {
|
||||
script.post (json, null);
|
||||
private async void post_rpc_message (string json, Bytes? data, Cancellable? cancellable) throws Error, IOError {
|
||||
script.post (json, data);
|
||||
}
|
||||
}
|
||||
|
||||
private enum TerminalMode {
|
||||
COOKED,
|
||||
RAW
|
||||
RAW,
|
||||
BINARY
|
||||
}
|
||||
}
|
||||
+17
-18
@@ -11,7 +11,7 @@ namespace Frida.Agent {
|
||||
PROCESS_TRANSITION
|
||||
}
|
||||
|
||||
private class Runner : Object, ProcessInvader, AgentSessionProvider, ExitHandler, ForkHandler, SpawnHandler {
|
||||
private sealed class Runner : Object, ProcessInvader, AgentSessionProvider, ExitHandler, ForkHandler, SpawnHandler {
|
||||
public static Runner shared_instance = null;
|
||||
public static Mutex shared_mutex;
|
||||
private static string? cached_agent_path = null;
|
||||
@@ -1509,13 +1509,14 @@ namespace Frida.Agent {
|
||||
}
|
||||
|
||||
public static NativeBridgeApi open () throws Error {
|
||||
string? nb_mod = null;
|
||||
string? vm_mod = null;
|
||||
Gum.Process.enumerate_modules ((details) => {
|
||||
if (/\/lib(64)?\/libnativebridge.so$/.match (details.path))
|
||||
nb_mod = details.path;
|
||||
else if (/^lib(art|dvm).so$/.match (details.name) && !/\/system\/fake-libs/.match (details.path))
|
||||
vm_mod = details.path;
|
||||
Gum.Module? nb_mod = null;
|
||||
Gum.Module? vm_mod = null;
|
||||
Gum.Process.enumerate_modules (module => {
|
||||
unowned string path = module.path;
|
||||
if (/\/lib(64)?\/libnativebridge.so$/.match (path))
|
||||
nb_mod = module;
|
||||
else if (/^lib(art|dvm).so$/.match (module.name) && !/\/system\/fake-libs/.match (path))
|
||||
vm_mod = module;
|
||||
bool carry_on = nb_mod == null || vm_mod == null;
|
||||
return carry_on;
|
||||
});
|
||||
@@ -1530,29 +1531,27 @@ namespace Frida.Agent {
|
||||
NBUnloadLibraryFunc? unload;
|
||||
NBGetTrampolineFunc get_trampoline;
|
||||
|
||||
load = (NBLoadLibraryFunc) Gum.Module.find_export_by_name (nb_mod, "NativeBridgeLoadLibrary");;
|
||||
load = (NBLoadLibraryFunc) nb_mod.find_export_by_name ("NativeBridgeLoadLibrary");;
|
||||
if (load != null) {
|
||||
flavor = MODERN;
|
||||
load_ext = (NBLoadLibraryExtFunc) Gum.Module.find_export_by_name (nb_mod, "NativeBridgeLoadLibraryExt");
|
||||
load_ext = (NBLoadLibraryExtFunc) nb_mod.find_export_by_name ("NativeBridgeLoadLibraryExt");
|
||||
// XXX: NativeBridgeUnloadLibrary() is only a stub as of Android 11 w/ libndk_translation.so
|
||||
unload = null;
|
||||
get_trampoline = (NBGetTrampolineFunc) Gum.Module.find_export_by_name (nb_mod,
|
||||
"NativeBridgeGetTrampoline");
|
||||
get_trampoline = (NBGetTrampolineFunc) nb_mod.find_export_by_name ("NativeBridgeGetTrampoline");
|
||||
} else {
|
||||
flavor = LEGACY;
|
||||
load = (NBLoadLibraryFunc) Gum.Module.find_export_by_name (nb_mod,
|
||||
"_ZN7android23NativeBridgeLoadLibraryEPKci");
|
||||
load_ext = (NBLoadLibraryExtFunc) Gum.Module.find_export_by_name (nb_mod,
|
||||
load = (NBLoadLibraryFunc) nb_mod.find_export_by_name ("_ZN7android23NativeBridgeLoadLibraryEPKci");
|
||||
load_ext = (NBLoadLibraryExtFunc) nb_mod.find_export_by_name (
|
||||
"_ZN7android26NativeBridgeLoadLibraryExtEPKciPNS_25native_bridge_namespace_tE");
|
||||
// XXX: Unload implementation seems to be unreliable.
|
||||
unload = null;
|
||||
get_trampoline = (NBGetTrampolineFunc) Gum.Module.find_export_by_name (nb_mod,
|
||||
get_trampoline = (NBGetTrampolineFunc) nb_mod.find_export_by_name (
|
||||
"_ZN7android25NativeBridgeGetTrampolineEPvPKcS2_j");
|
||||
}
|
||||
if (load == null || get_trampoline == null)
|
||||
throw new Error.NOT_SUPPORTED ("NativeBridge API is not available on this system");
|
||||
|
||||
var get_vms = (JNIGetCreatedJavaVMsFunc) Gum.Module.find_export_by_name (vm_mod, "JNI_GetCreatedJavaVMs");
|
||||
var get_vms = (JNIGetCreatedJavaVMsFunc) vm_mod.find_export_by_name ("JNI_GetCreatedJavaVMs");
|
||||
if (get_vms == null)
|
||||
throw new Error.NOT_SUPPORTED ("Unable to locate Java VM");
|
||||
|
||||
@@ -1622,7 +1621,7 @@ namespace Frida.Agent {
|
||||
}
|
||||
#endif
|
||||
|
||||
private class LiveAgentSession : BaseAgentSession {
|
||||
private sealed class LiveAgentSession : BaseAgentSession {
|
||||
public uint registration_id {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
global:
|
||||
frida_agent_main;
|
||||
JNI_OnLoad;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
global:
|
||||
frida_agent_main;
|
||||
JNI_OnLoad;
|
||||
|
||||
local:
|
||||
*;
|
||||
|
||||
@@ -28,7 +28,7 @@ if host_os_family == 'windows'
|
||||
elif host_os_family == 'darwin'
|
||||
extra_link_args += '-Wl,-exported_symbol,_frida_agent_main'
|
||||
else
|
||||
symscript = 'frida-agent.version'
|
||||
symscript = (host_os == 'android') ? 'frida-agent-android.version' : 'frida-agent.version'
|
||||
extra_link_args += '-Wl,--version-script,' + meson.current_source_dir() / symscript
|
||||
extra_link_depends += symscript
|
||||
endif
|
||||
|
||||
+137
-11
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class BufferBuilder : Object {
|
||||
public sealed class BufferBuilder : Object {
|
||||
public ByteOrder byte_order {
|
||||
get;
|
||||
construct;
|
||||
@@ -307,7 +307,7 @@ namespace Frida {
|
||||
NUL
|
||||
}
|
||||
|
||||
public class Buffer : Object {
|
||||
public sealed class Buffer : Object {
|
||||
public Bytes bytes {
|
||||
get;
|
||||
construct;
|
||||
@@ -428,21 +428,28 @@ namespace Frida {
|
||||
return *((double *) &bits);
|
||||
}
|
||||
|
||||
public string read_string (size_t offset) {
|
||||
public string read_string (size_t offset) throws Error {
|
||||
string * start = (string *) get_pointer (offset, sizeof (char));
|
||||
size_t max_length = size - offset;
|
||||
string * val = (string *) get_pointer (offset, sizeof (char));
|
||||
string * end = memchr (val, 0, max_length);
|
||||
assert (end != null);
|
||||
size_t size = end - val;
|
||||
return val->substring (0, (long) size);
|
||||
string * end = memchr (start, 0, max_length);
|
||||
if (end == null)
|
||||
throw new Error.PROTOCOL ("Missing null character");
|
||||
size_t size = end - start;
|
||||
string val = start->substring (0, (long) size);
|
||||
if (!val.validate ())
|
||||
throw new Error.PROTOCOL ("Invalid UTF-8 string");
|
||||
return val;
|
||||
}
|
||||
|
||||
[CCode (cname = "memchr", cheader_filename = "string.h")]
|
||||
private extern static string * memchr (string * s, int c, size_t n);
|
||||
|
||||
public string read_fixed_string (size_t offset, size_t size) {
|
||||
string * val = (string *) get_pointer (offset, size);
|
||||
return val->substring (0, (long) size);
|
||||
public string read_fixed_string (size_t offset, size_t size) throws Error {
|
||||
string * start = (string *) get_pointer (offset, size);
|
||||
string val = start->substring (0, (long) size);
|
||||
if (!val.validate ())
|
||||
throw new Error.PROTOCOL ("Invalid UTF-8 string");
|
||||
return val;
|
||||
}
|
||||
|
||||
public unowned Buffer write_string (size_t offset, string val) {
|
||||
@@ -458,4 +465,123 @@ namespace Frida {
|
||||
return data + offset;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class BufferReader {
|
||||
public size_t available {
|
||||
get {
|
||||
return buffer.bytes.get_size () - offset;
|
||||
}
|
||||
}
|
||||
|
||||
private Buffer buffer;
|
||||
private size_t offset = 0;
|
||||
|
||||
public BufferReader (Buffer buf) {
|
||||
buffer = buf;
|
||||
}
|
||||
|
||||
public uint64 read_pointer (size_t offset) throws Error {
|
||||
var pointer_size = buffer.pointer_size;
|
||||
check_available (pointer_size);
|
||||
var ptr = buffer.read_pointer (offset);
|
||||
offset += pointer_size;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
public int8 read_int8 () throws Error {
|
||||
check_available (sizeof (int8));
|
||||
var val = buffer.read_int8 (offset);
|
||||
offset += sizeof (int8);
|
||||
return val;
|
||||
}
|
||||
|
||||
public uint8 read_uint8 () throws Error {
|
||||
check_available (sizeof (uint8));
|
||||
var val = buffer.read_uint8 (offset);
|
||||
offset += sizeof (uint8);
|
||||
return val;
|
||||
}
|
||||
|
||||
public int16 read_int16 () throws Error {
|
||||
check_available (sizeof (int16));
|
||||
var val = buffer.read_int16 (offset);
|
||||
offset += sizeof (int16);
|
||||
return val;
|
||||
}
|
||||
|
||||
public uint16 read_uint16 () throws Error {
|
||||
check_available (sizeof (uint16));
|
||||
var val = buffer.read_uint16 (offset);
|
||||
offset += sizeof (uint16);
|
||||
return val;
|
||||
}
|
||||
|
||||
public int32 read_int32 () throws Error {
|
||||
check_available (sizeof (int32));
|
||||
var val = buffer.read_int32 (offset);
|
||||
offset += sizeof (int32);
|
||||
return val;
|
||||
}
|
||||
|
||||
public uint32 read_uint32 () throws Error {
|
||||
check_available (sizeof (uint32));
|
||||
var val = buffer.read_uint32 (offset);
|
||||
offset += sizeof (uint32);
|
||||
return val;
|
||||
}
|
||||
|
||||
public int64 read_int64 () throws Error {
|
||||
check_available (sizeof (int64));
|
||||
var val = buffer.read_int64 (offset);
|
||||
offset += sizeof (int64);
|
||||
return val;
|
||||
}
|
||||
|
||||
public uint64 read_uint64 () throws Error {
|
||||
check_available (sizeof (uint64));
|
||||
var val = buffer.read_uint64 (offset);
|
||||
offset += sizeof (uint64);
|
||||
return val;
|
||||
}
|
||||
|
||||
public float read_float () throws Error {
|
||||
check_available (sizeof (float));
|
||||
var val = buffer.read_float (offset);
|
||||
offset += sizeof (float);
|
||||
return val;
|
||||
}
|
||||
|
||||
public double read_double () throws Error {
|
||||
check_available (sizeof (double));
|
||||
var val = buffer.read_double (offset);
|
||||
offset += sizeof (double);
|
||||
return val;
|
||||
}
|
||||
|
||||
public string read_string () throws Error {
|
||||
check_available (1);
|
||||
var val = buffer.read_string (offset);
|
||||
offset += val.length + 1;
|
||||
return val;
|
||||
}
|
||||
|
||||
public string read_fixed_string (size_t size) throws Error {
|
||||
check_available (size);
|
||||
var val = buffer.read_fixed_string (offset, size);
|
||||
offset += size;
|
||||
return val;
|
||||
}
|
||||
|
||||
public Bytes read_bytes (size_t size) throws Error {
|
||||
check_available (size);
|
||||
var val = buffer.bytes[offset:offset + size];
|
||||
offset += size;
|
||||
return val;
|
||||
}
|
||||
|
||||
private void check_available (size_t n) throws Error {
|
||||
if (available < n)
|
||||
throw new Error.PROTOCOL ("Malformed buffer: truncated");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
namespace Frida {
|
||||
public sealed class ChannelRegistry : Object {
|
||||
public signal void channel_closed (ChannelId id);
|
||||
|
||||
private Gee.Map<ChannelId?, weak IOStream> channels =
|
||||
new Gee.HashMap<ChannelId?, weak IOStream> (ChannelId.hash, ChannelId.equal);
|
||||
|
||||
~ChannelRegistry () {
|
||||
clear ();
|
||||
}
|
||||
|
||||
public void clear () {
|
||||
foreach (IOStream stream in channels.values.to_array ()) {
|
||||
var channel_stream = stream as ChannelStream;
|
||||
if (channel_stream != null)
|
||||
channel_stream.abandon ();
|
||||
}
|
||||
channels.clear ();
|
||||
}
|
||||
|
||||
public void register (ChannelId id, IOStream stream) {
|
||||
stream.set_data ("channel-registry-entry", new Entry (this, id));
|
||||
lock (channels)
|
||||
channels[id] = stream;
|
||||
}
|
||||
|
||||
public IOStream link (ChannelId id) throws Error {
|
||||
IOStream? stream;
|
||||
lock (channels)
|
||||
stream = channels[id];
|
||||
if (stream == null)
|
||||
throw new Error.INVALID_ARGUMENT ("Invalid channel ID");
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void unlink (ChannelId id) {
|
||||
lock (channels) {
|
||||
if (!channels.unset (id))
|
||||
return;
|
||||
}
|
||||
|
||||
channel_closed (id);
|
||||
}
|
||||
|
||||
private class Entry {
|
||||
public ChannelRegistry parent;
|
||||
public ChannelId id;
|
||||
|
||||
public Entry (ChannelRegistry parent, ChannelId id) {
|
||||
this.parent = parent;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
~Entry () {
|
||||
parent.unlink (id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ChannelEndpoint : Object, Channel {
|
||||
private IOStream? stream;
|
||||
|
||||
private ByteArray write_queue = new ByteArray ();
|
||||
private bool writing = false;
|
||||
|
||||
private Cancellable io_cancellable = new Cancellable ();
|
||||
|
||||
public ChannelEndpoint (IOStream stream) {
|
||||
this.stream = stream;
|
||||
|
||||
read_loop.begin ();
|
||||
}
|
||||
|
||||
public async void close (Cancellable? cancellable) throws Error, IOError {
|
||||
io_cancellable.cancel ();
|
||||
}
|
||||
|
||||
public async void input (uint8[] data, Cancellable? cancellable) throws Error, IOError {
|
||||
if (io_cancellable.is_cancelled ())
|
||||
throw new Error.INVALID_OPERATION ("Channel is closed");
|
||||
|
||||
write_queue.append (data);
|
||||
|
||||
if (!writing) {
|
||||
writing = true;
|
||||
|
||||
var source = new IdleSource ();
|
||||
source.set_callback (() => {
|
||||
process_write_queue.begin ();
|
||||
return false;
|
||||
});
|
||||
source.attach (MainContext.get_thread_default ());
|
||||
}
|
||||
}
|
||||
|
||||
private async void read_loop () {
|
||||
var input = stream.get_input_stream ();
|
||||
var buffer = new uint8[64 * 1024];
|
||||
|
||||
while (true) {
|
||||
ssize_t n;
|
||||
try {
|
||||
n = yield input.read_async (buffer, Priority.DEFAULT, io_cancellable);
|
||||
} catch (GLib.Error e) {
|
||||
break;
|
||||
}
|
||||
|
||||
output (buffer[:n]);
|
||||
|
||||
if (n == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
stream.close_async.begin ();
|
||||
stream = null;
|
||||
}
|
||||
|
||||
private async void process_write_queue () {
|
||||
if (stream != null) {
|
||||
var output = stream.get_output_stream ();
|
||||
|
||||
while (write_queue.len > 0) {
|
||||
uint8[] batch = write_queue.steal ();
|
||||
|
||||
size_t bytes_written;
|
||||
try {
|
||||
yield output.write_all_async (batch, Priority.DEFAULT, io_cancellable, out bytes_written);
|
||||
} catch (GLib.Error e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ChannelStream : VirtualStream {
|
||||
public Channel channel {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
private ByteArray recv_queue = new ByteArray ();
|
||||
private ByteArray send_queue = new ByteArray ();
|
||||
|
||||
public ChannelStream (Channel channel) {
|
||||
Object (channel: channel);
|
||||
}
|
||||
|
||||
construct {
|
||||
channel.output.connect (on_output);
|
||||
}
|
||||
|
||||
public void abandon () {
|
||||
with_state_lock (() => {
|
||||
state = CLOSED;
|
||||
update_pending_io ();
|
||||
});
|
||||
}
|
||||
|
||||
protected override IOCondition query_events () {
|
||||
IOCondition new_events = 0;
|
||||
|
||||
if (recv_queue.len != 0 || state == CLOSED)
|
||||
new_events |= IN;
|
||||
|
||||
if (state == OPEN)
|
||||
new_events |= OUT;
|
||||
|
||||
return new_events;
|
||||
}
|
||||
|
||||
protected override void handle_close () {
|
||||
channel.close.begin (null);
|
||||
}
|
||||
|
||||
public override ssize_t read (uint8[] buffer) throws IOError {
|
||||
ssize_t n = 0;
|
||||
with_state_lock (() => {
|
||||
n = ssize_t.min (recv_queue.len, buffer.length);
|
||||
if (n > 0) {
|
||||
Memory.copy (buffer, recv_queue.data, n);
|
||||
recv_queue.remove_range (0, (uint) n);
|
||||
|
||||
update_pending_io ();
|
||||
} else {
|
||||
if (state == OPEN)
|
||||
n = -1;
|
||||
}
|
||||
});
|
||||
|
||||
if (n == -1)
|
||||
throw new IOError.WOULD_BLOCK ("Resource temporarily unavailable");
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
public override ssize_t write (uint8[] buffer) throws IOError {
|
||||
with_state_lock (() => {
|
||||
send_queue.append (buffer);
|
||||
});
|
||||
|
||||
if (main_context.is_owner ()) {
|
||||
process_send_queue ();
|
||||
} else {
|
||||
var source = new IdleSource ();
|
||||
source.set_callback (() => {
|
||||
process_send_queue ();
|
||||
return Source.REMOVE;
|
||||
});
|
||||
source.attach (main_context);
|
||||
}
|
||||
|
||||
return buffer.length;
|
||||
}
|
||||
|
||||
private void process_send_queue () {
|
||||
uint8[]? chunk = null;
|
||||
with_state_lock (() => {
|
||||
size_t n = send_queue.len;
|
||||
if (n == 0)
|
||||
return;
|
||||
chunk = send_queue.data[0:n];
|
||||
send_queue.remove_range (0, (uint) n);
|
||||
});
|
||||
if (chunk == null)
|
||||
return;
|
||||
|
||||
channel.input.begin (chunk, io_cancellable);
|
||||
}
|
||||
|
||||
private void on_output (uint8[] data) {
|
||||
with_state_lock (() => {
|
||||
if (data.length != 0)
|
||||
recv_queue.append (data);
|
||||
else
|
||||
state = CLOSED;
|
||||
update_pending_io ();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
namespace Frida {
|
||||
public sealed class CFArray<T> {
|
||||
private CoreFoundation.Array handle;
|
||||
|
||||
public static CFArray<T> wrap<T> (void * handle) {
|
||||
return new CFArray<T> ((CoreFoundation.Array) handle);
|
||||
}
|
||||
|
||||
private CFArray (CoreFoundation.Array handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public Iterator<T> iterator () {
|
||||
return new Iterator<T> (handle);
|
||||
}
|
||||
|
||||
public class Iterator<T> {
|
||||
public CoreFoundation.Array handle;
|
||||
private CoreFoundation.Index i = 0;
|
||||
private CoreFoundation.Index length;
|
||||
|
||||
internal Iterator (CoreFoundation.Array arr) {
|
||||
handle = arr;
|
||||
length = arr.length;
|
||||
}
|
||||
|
||||
public unowned T? next_value () {
|
||||
if (i == length)
|
||||
return null;
|
||||
return handle[i++];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -60,7 +60,7 @@ namespace Frida {
|
||||
return yield connection.get_proxy (null, ObjectPath.HOST_SESSION, DBusProxyFlags.NONE, cancellable);
|
||||
}
|
||||
|
||||
private class DummyInputStream : InputStream {
|
||||
private sealed class DummyInputStream : InputStream {
|
||||
private bool done = false;
|
||||
private Mutex mutex;
|
||||
private Cond cond;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "frida-darwin.h"
|
||||
|
||||
gpointer
|
||||
_frida_dispatch_retain (gpointer object)
|
||||
{
|
||||
dispatch_retain (object);
|
||||
return object;
|
||||
}
|
||||
|
||||
void
|
||||
_frida_xpc_connection_set_event_handler (xpc_connection_t connection, FridaXpcHandler handler, gpointer user_data)
|
||||
{
|
||||
xpc_connection_set_event_handler (connection, ^(xpc_object_t object)
|
||||
{
|
||||
handler (object, user_data);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
_frida_xpc_connection_send_message_with_reply (xpc_connection_t connection, xpc_object_t message, dispatch_queue_t replyq,
|
||||
FridaXpcHandler handler, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
xpc_connection_send_message_with_reply (connection, message, replyq, ^(xpc_object_t object)
|
||||
{
|
||||
handler (object, user_data);
|
||||
if (notify != NULL)
|
||||
notify (user_data);
|
||||
});
|
||||
}
|
||||
|
||||
gchar *
|
||||
_frida_xpc_object_to_string (xpc_object_t object)
|
||||
{
|
||||
gchar * result;
|
||||
char * str;
|
||||
|
||||
str = xpc_copy_description (object);
|
||||
result = g_strdup (str);
|
||||
free (str);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_frida_xpc_dictionary_apply (xpc_object_t dict, FridaXpcDictionaryApplier applier, gpointer user_data)
|
||||
{
|
||||
return xpc_dictionary_apply (dict, ^bool (const char * key, xpc_object_t val)
|
||||
{
|
||||
return applier (key, val, user_data);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef __FRIDA_DARWIN_H__
|
||||
#define __FRIDA_DARWIN_H__
|
||||
|
||||
#ifdef HAVE_MACOS
|
||||
|
||||
#include <glib.h>
|
||||
#include <xpc/xpc.h>
|
||||
|
||||
typedef void (* FridaXpcHandler) (xpc_object_t object, gpointer user_data);
|
||||
typedef gboolean (* FridaXpcDictionaryApplier) (const gchar * key, xpc_object_t val, gpointer user_data);
|
||||
|
||||
gpointer _frida_dispatch_retain (gpointer object);
|
||||
|
||||
void _frida_xpc_connection_set_event_handler (xpc_connection_t connection, FridaXpcHandler handler, gpointer user_data);
|
||||
void _frida_xpc_connection_send_message_with_reply (xpc_connection_t connection, xpc_object_t message, dispatch_queue_t replyq,
|
||||
FridaXpcHandler handler, gpointer user_data, GDestroyNotify notify);
|
||||
gchar * _frida_xpc_object_to_string (xpc_object_t object);
|
||||
gboolean _frida_xpc_dictionary_apply (xpc_object_t dict, FridaXpcDictionaryApplier applier, gpointer user_data);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+27
-1
@@ -1,6 +1,9 @@
|
||||
base_sources = [
|
||||
'session.vala',
|
||||
'session-glue.c',
|
||||
'channel.vala',
|
||||
'service.vala',
|
||||
'stream.vala',
|
||||
'rpc.vala',
|
||||
'p2p.vala',
|
||||
'p2p-glue.c',
|
||||
@@ -9,9 +12,22 @@ base_sources = [
|
||||
'socket.vala',
|
||||
'socket-glue.c',
|
||||
'buffer.vala',
|
||||
'value.vala',
|
||||
]
|
||||
|
||||
extra_vala_args = []
|
||||
|
||||
if host_os == 'macos'
|
||||
base_sources += [
|
||||
'xpc.vala',
|
||||
'frida-darwin.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_os_family == 'darwin'
|
||||
base_sources += 'corefoundation.vala'
|
||||
endif
|
||||
|
||||
extra_deps = []
|
||||
if host_os_family != 'windows'
|
||||
extra_vala_args += '--pkg=gio-unix-2.0'
|
||||
@@ -22,15 +38,25 @@ base_vala_args = [gum_vala_args, '--pkg=gio-2.0', '--pkg=json-glib-1.0']
|
||||
if nice_dep.found()
|
||||
base_vala_args += '--pkg=nice'
|
||||
endif
|
||||
if host_os_family == 'darwin'
|
||||
base_vala_args += [
|
||||
'--pkg=corefoundation',
|
||||
'--pkg=darwin-gcd',
|
||||
'--pkg=darwin-xpc',
|
||||
]
|
||||
endif
|
||||
|
||||
base_gir_name = f'FridaBase-@[email protected]'
|
||||
|
||||
base = static_library('frida-base-' + api_version, base_sources,
|
||||
c_args: frida_component_cflags,
|
||||
vala_args: [base_vala_args, '--pkg=libsoup-3.0'] + extra_vala_args,
|
||||
vala_header: 'frida-base.h',
|
||||
vala_gir: base_gir_name,
|
||||
vala_vapi: f'frida-base-@[email protected]',
|
||||
dependencies: [glib_dep, gobject_dep, gio_dep, libsoup_dep, nice_dep, usrsctp_dep, gee_dep, json_glib_dep, gum_dep, openssl_dep] + extra_deps,
|
||||
install: true,
|
||||
install_dir: [true, header_install_dir, true],
|
||||
install_dir: [true, header_install_dir, true, false],
|
||||
)
|
||||
|
||||
base_dep = declare_dependency(
|
||||
|
||||
+37
-248
@@ -169,7 +169,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class PeerSocket : Object, DatagramBased {
|
||||
public sealed class PeerSocket : Object, DatagramBased {
|
||||
public Nice.Agent agent {
|
||||
get;
|
||||
construct;
|
||||
@@ -452,6 +452,8 @@ namespace Frida {
|
||||
if ((_pending_io & c) != 0)
|
||||
source.set_ready_time (0);
|
||||
}
|
||||
|
||||
notify_property ("pending-io");
|
||||
}
|
||||
|
||||
private void prepare_for_io (int64 timeout, Cancellable? cancellable, out int64 deadline) throws IOError {
|
||||
@@ -563,7 +565,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class SctpConnection : IOStream {
|
||||
public sealed class SctpConnection : VirtualStream {
|
||||
public DatagramBased transport_socket {
|
||||
get;
|
||||
construct;
|
||||
@@ -584,55 +586,14 @@ namespace Frida {
|
||||
construct;
|
||||
}
|
||||
|
||||
public State state {
|
||||
get {
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
public override InputStream input_stream {
|
||||
get {
|
||||
return _input_stream;
|
||||
}
|
||||
}
|
||||
|
||||
public override OutputStream output_stream {
|
||||
get {
|
||||
return _output_stream;
|
||||
}
|
||||
}
|
||||
|
||||
public IOCondition pending_io {
|
||||
get {
|
||||
lock (state)
|
||||
return sctp_events;
|
||||
}
|
||||
}
|
||||
|
||||
private State _state = CREATED;
|
||||
private SctpInputStream _input_stream;
|
||||
private SctpOutputStream _output_stream;
|
||||
|
||||
private DatagramBasedSource transport_source;
|
||||
private uint8[] transport_buffer = new uint8[65536];
|
||||
|
||||
private void * sctp_socket;
|
||||
private IOCondition sctp_events = 0;
|
||||
private SctpTimerSource sctp_source;
|
||||
private uint16 stream_id;
|
||||
private ByteArray dcep_message = new ByteArray ();
|
||||
|
||||
private Gee.Map<unowned Source, IOCondition> sources = new Gee.HashMap<unowned Source, IOCondition> ();
|
||||
|
||||
private Cancellable io_cancellable = new Cancellable ();
|
||||
|
||||
public enum State {
|
||||
CREATED,
|
||||
OPENING,
|
||||
OPENED,
|
||||
CLOSED
|
||||
}
|
||||
|
||||
public SctpConnection (DatagramBased transport_socket, PeerSetup setup, uint16 port, size_t max_message_size) {
|
||||
Object (
|
||||
transport_socket: transport_socket,
|
||||
@@ -649,14 +610,9 @@ namespace Frida {
|
||||
protected extern static void _initialize_sctp_backend ();
|
||||
|
||||
construct {
|
||||
_input_stream = new SctpInputStream (this);
|
||||
_output_stream = new SctpOutputStream (this);
|
||||
|
||||
sctp_socket = _create_sctp_socket ();
|
||||
_connect_sctp_socket (sctp_socket, port);
|
||||
|
||||
var main_context = MainContext.get_thread_default ();
|
||||
|
||||
transport_source = transport_socket.create_source (IOCondition.IN, io_cancellable);
|
||||
transport_source.set_callback (on_transport_socket_readable);
|
||||
transport_source.attach (main_context);
|
||||
@@ -669,17 +625,22 @@ namespace Frida {
|
||||
|
||||
protected extern void _connect_sctp_socket (void * sock, uint16 port);
|
||||
|
||||
public override bool close (GLib.Cancellable? cancellable) throws IOError {
|
||||
do_close ();
|
||||
return true;
|
||||
protected override VirtualStream.State query_initial_state () {
|
||||
return CREATED;
|
||||
}
|
||||
|
||||
public override async bool close_async (int io_priority, GLib.Cancellable? cancellable) throws IOError {
|
||||
do_close ();
|
||||
return true;
|
||||
protected override IOCondition query_events () {
|
||||
return _query_sctp_socket_events (sctp_socket);
|
||||
}
|
||||
|
||||
private void do_close () {
|
||||
protected override void update_pending_io () {
|
||||
base.update_pending_io ();
|
||||
sctp_source.invalidate ();
|
||||
}
|
||||
|
||||
protected extern static IOCondition _query_sctp_socket_events (void * sock);
|
||||
|
||||
protected override void handle_close () {
|
||||
sctp_source.destroy ();
|
||||
transport_source.destroy ();
|
||||
|
||||
@@ -689,13 +650,17 @@ namespace Frida {
|
||||
|
||||
public extern static void _close (void * sock);
|
||||
|
||||
public void shutdown (SctpShutdownType type) throws IOError {
|
||||
_shutdown (sctp_socket, type);
|
||||
public override void shutdown_read () throws IOError {
|
||||
_shutdown (sctp_socket, READ);
|
||||
}
|
||||
|
||||
public override void shutdown_write () throws IOError {
|
||||
_shutdown (sctp_socket, WRITE);
|
||||
}
|
||||
|
||||
public extern static void _shutdown (void * sock, SctpShutdownType type) throws IOError;
|
||||
|
||||
public ssize_t recv (uint8[] buffer) throws IOError {
|
||||
public override ssize_t read (uint8[] buffer) throws IOError {
|
||||
ssize_t n = -1;
|
||||
|
||||
try {
|
||||
@@ -711,18 +676,18 @@ namespace Frida {
|
||||
handle_dcep_message (stream_id, dcep_message.steal ());
|
||||
}
|
||||
throw new IOError.WOULD_BLOCK ("Resource temporarily unavailable");
|
||||
} else if (protocol_id == NONE || _state != OPENED) {
|
||||
} else if (protocol_id == NONE || state != OPEN) {
|
||||
throw new IOError.WOULD_BLOCK ("Resource temporarily unavailable");
|
||||
}
|
||||
} finally {
|
||||
update_sctp_events ();
|
||||
update_pending_io ();
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
public ssize_t send (uint8[] buffer) throws IOError {
|
||||
if (_state != OPENED)
|
||||
public override ssize_t write (uint8[] buffer) throws IOError {
|
||||
if (state != OPEN)
|
||||
throw new IOError.WOULD_BLOCK ("Resource temporarily unavailable");
|
||||
|
||||
ssize_t n = ssize_t.min (buffer.length, (ssize_t) max_message_size);
|
||||
@@ -730,20 +695,10 @@ namespace Frida {
|
||||
try {
|
||||
return _send (sctp_socket, stream_id, WEBRTC_BINARY, buffer[0:n]);
|
||||
} finally {
|
||||
update_sctp_events ();
|
||||
update_pending_io ();
|
||||
}
|
||||
}
|
||||
|
||||
public void register_source (Source source, IOCondition condition) {
|
||||
lock (state)
|
||||
sources[source] = condition | IOCondition.ERR | IOCondition.HUP;
|
||||
}
|
||||
|
||||
public void unregister_source (Source source) {
|
||||
lock (state)
|
||||
sources.unset (source);
|
||||
}
|
||||
|
||||
private bool on_transport_socket_readable (DatagramBased datagram_based, IOCondition condition) {
|
||||
var v = InputVector ();
|
||||
v.buffer = transport_buffer;
|
||||
@@ -774,31 +729,18 @@ namespace Frida {
|
||||
protected extern void _handle_transport_packet (uint8[] data);
|
||||
|
||||
protected int _emit_transport_packet (uint8[] data) {
|
||||
var v = OutputVector ();
|
||||
v.buffer = data;
|
||||
v.size = data.length;
|
||||
|
||||
OutputVector[] vectors = { v };
|
||||
|
||||
var m = OutputMessage ();
|
||||
m.vectors = vectors;
|
||||
m.num_vectors = vectors.length;
|
||||
|
||||
OutputMessage[] messages = { m };
|
||||
|
||||
try {
|
||||
transport_socket.send_messages (messages, 0, 0, io_cancellable);
|
||||
Udp.send (data, transport_socket, io_cancellable);
|
||||
return 0;
|
||||
} catch (GLib.Error e) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected void _on_sctp_socket_events_changed () {
|
||||
update_sctp_events ();
|
||||
update_pending_io ();
|
||||
|
||||
if (_state == CREATED && setup == ACTIVE && (sctp_events & IOCondition.OUT) != 0) {
|
||||
if (state == CREATED && setup == ACTIVE && (pending_io & IOCondition.OUT) != 0) {
|
||||
stream_id = 1;
|
||||
|
||||
uint8[] open_message = {
|
||||
@@ -812,31 +754,12 @@ namespace Frida {
|
||||
};
|
||||
try {
|
||||
_send (sctp_socket, stream_id, WEBRTC_DCEP, open_message);
|
||||
_state = OPENING;
|
||||
state = OPENING;
|
||||
} catch (IOError e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void update_sctp_events () {
|
||||
IOCondition new_events = _query_sctp_socket_events (sctp_socket);
|
||||
|
||||
lock (state) {
|
||||
sctp_events = new_events;
|
||||
|
||||
foreach (var entry in sources.entries) {
|
||||
unowned Source source = entry.key;
|
||||
IOCondition c = entry.value;
|
||||
if ((new_events & c) != 0)
|
||||
source.set_ready_time (0);
|
||||
}
|
||||
|
||||
sctp_source.invalidate ();
|
||||
}
|
||||
}
|
||||
|
||||
protected extern static IOCondition _query_sctp_socket_events (void * sock);
|
||||
|
||||
protected extern static ssize_t _recv (void * sock, uint8[] buffer, out uint16 stream_id,
|
||||
out PayloadProtocolId protocol_id, out SctpMessageFlags message_flags) throws IOError;
|
||||
|
||||
@@ -848,7 +771,7 @@ namespace Frida {
|
||||
|
||||
switch (type) {
|
||||
case DATA_CHANNEL_OPEN: {
|
||||
if (_state != CREATED || setup == ACTIVE)
|
||||
if (state != CREATED || setup == ACTIVE)
|
||||
return;
|
||||
|
||||
this.stream_id = stream_id;
|
||||
@@ -856,15 +779,15 @@ namespace Frida {
|
||||
uint8[] reply = { DcepMessageType.DATA_CHANNEL_ACK };
|
||||
_send (sctp_socket, stream_id, WEBRTC_DCEP, reply);
|
||||
|
||||
_state = OPENED;
|
||||
state = OPEN;
|
||||
|
||||
break;
|
||||
}
|
||||
case DATA_CHANNEL_ACK:
|
||||
if (_state != OPENING)
|
||||
if (state != OPENING)
|
||||
return;
|
||||
|
||||
_state = OPENED;
|
||||
state = OPEN;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -899,140 +822,6 @@ namespace Frida {
|
||||
DATA_CHANNEL_ACK = 0x02
|
||||
}
|
||||
|
||||
private class SctpInputStream : InputStream, PollableInputStream {
|
||||
public weak SctpConnection connection {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
public SctpInputStream (SctpConnection connection) {
|
||||
Object (connection: connection);
|
||||
}
|
||||
|
||||
public override bool close (Cancellable? cancellable) throws IOError {
|
||||
connection.shutdown (READ);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool close_async (int io_priority, Cancellable? cancellable) throws GLib.IOError {
|
||||
return close (cancellable);
|
||||
}
|
||||
|
||||
public override ssize_t read (uint8[] buffer, Cancellable? cancellable) throws IOError {
|
||||
assert_not_reached ();
|
||||
}
|
||||
|
||||
public bool can_poll () {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool is_readable () {
|
||||
return (connection.pending_io & IOCondition.IN) != 0;
|
||||
}
|
||||
|
||||
public PollableSource create_source (Cancellable? cancellable) {
|
||||
return new PollableSource.full (this, new SctpIOSource (connection, IOCondition.IN), cancellable);
|
||||
}
|
||||
|
||||
public ssize_t read_nonblocking_fn (uint8[] buffer) throws GLib.Error {
|
||||
return connection.recv (buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private class SctpOutputStream : OutputStream, PollableOutputStream {
|
||||
public weak SctpConnection connection {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
public SctpOutputStream (SctpConnection connection) {
|
||||
Object (connection: connection);
|
||||
}
|
||||
|
||||
public override bool close (Cancellable? cancellable) throws IOError {
|
||||
connection.shutdown (WRITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool close_async (int io_priority, Cancellable? cancellable) throws GLib.IOError {
|
||||
return close (cancellable);
|
||||
}
|
||||
|
||||
public override bool flush (GLib.Cancellable? cancellable) throws GLib.Error {
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool flush_async (int io_priority, GLib.Cancellable? cancellable) throws GLib.Error {
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ssize_t write (uint8[] buffer, Cancellable? cancellable) throws IOError {
|
||||
assert_not_reached ();
|
||||
}
|
||||
|
||||
public bool can_poll () {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool is_writable () {
|
||||
return (connection.pending_io & IOCondition.OUT) != 0;
|
||||
}
|
||||
|
||||
public PollableSource create_source (Cancellable? cancellable) {
|
||||
return new PollableSource.full (this, new SctpIOSource (connection, IOCondition.OUT), cancellable);
|
||||
}
|
||||
|
||||
public ssize_t write_nonblocking_fn (uint8[]? buffer) throws GLib.Error {
|
||||
return connection.send (buffer);
|
||||
}
|
||||
|
||||
public PollableReturn writev_nonblocking_fn (OutputVector[] vectors, out size_t bytes_written) throws GLib.Error {
|
||||
assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
private class SctpIOSource : Source {
|
||||
public SctpConnection connection;
|
||||
public IOCondition condition;
|
||||
|
||||
public SctpIOSource (SctpConnection connection, IOCondition condition) {
|
||||
this.connection = connection;
|
||||
this.condition = condition;
|
||||
|
||||
connection.register_source (this, condition);
|
||||
}
|
||||
|
||||
~SctpIOSource () {
|
||||
connection.unregister_source (this);
|
||||
}
|
||||
|
||||
protected override bool prepare (out int timeout) {
|
||||
timeout = -1;
|
||||
return (connection.pending_io & condition) != 0;
|
||||
}
|
||||
|
||||
protected override bool check () {
|
||||
return (connection.pending_io & condition) != 0;
|
||||
}
|
||||
|
||||
protected override bool dispatch (SourceFunc? callback) {
|
||||
set_ready_time (-1);
|
||||
|
||||
if (callback == null)
|
||||
return Source.REMOVE;
|
||||
|
||||
return callback ();
|
||||
}
|
||||
|
||||
protected static bool closure_callback (Closure closure) {
|
||||
var return_value = Value (typeof (bool));
|
||||
|
||||
closure.invoke (ref return_value, {});
|
||||
|
||||
return return_value.get_boolean ();
|
||||
}
|
||||
}
|
||||
|
||||
private class SctpTimerSource : Source {
|
||||
private static int64 last_process_time = -1;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class Promise<T> {
|
||||
public sealed class Promise<T> {
|
||||
private Impl<T> impl;
|
||||
|
||||
public Future<T> future {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class RpcClient : Object {
|
||||
public sealed class RpcClient : Object {
|
||||
public weak RpcPeer peer {
|
||||
get;
|
||||
construct;
|
||||
@@ -11,7 +11,7 @@ namespace Frida {
|
||||
Object (peer: peer);
|
||||
}
|
||||
|
||||
public async Json.Node call (string method, Json.Node[] args, Cancellable? cancellable) throws Error, IOError {
|
||||
public async Json.Node call (string method, Json.Node[] args, Bytes? data, Cancellable? cancellable) throws Error, IOError {
|
||||
string request_id = Uuid.string_random ();
|
||||
|
||||
var request = new Json.Builder ();
|
||||
@@ -39,7 +39,7 @@ namespace Frida {
|
||||
pending_responses[request_id] = pending;
|
||||
|
||||
try {
|
||||
yield peer.post_rpc_message (raw_request, cancellable);
|
||||
yield peer.post_rpc_message (raw_request, data, cancellable);
|
||||
} catch (Error e) {
|
||||
if (pending_responses.unset (request_id))
|
||||
pending.complete_with_error (e);
|
||||
@@ -158,6 +158,6 @@ namespace Frida {
|
||||
}
|
||||
|
||||
public interface RpcPeer : Object {
|
||||
public abstract async void post_rpc_message (string json, Cancellable? cancellable) throws Error, IOError;
|
||||
public abstract async void post_rpc_message (string json, Bytes? data, Cancellable? cancellable) throws Error, IOError;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace Frida {
|
||||
public sealed class ServiceSessionRegistry : Object {
|
||||
public signal void session_closed (ServiceSessionId id);
|
||||
|
||||
private Gee.Map<ServiceSessionId?, ServiceSession> sessions =
|
||||
new Gee.HashMap<ServiceSessionId?, ServiceSession> (ServiceSessionId.hash, ServiceSessionId.equal);
|
||||
|
||||
~ServiceSessionRegistry () {
|
||||
clear ();
|
||||
}
|
||||
|
||||
public void clear () {
|
||||
foreach (var session in sessions.values.to_array ())
|
||||
session.close ();
|
||||
sessions.clear ();
|
||||
}
|
||||
|
||||
public void register (ServiceSessionId id, ServiceSession session) {
|
||||
sessions[id] = session;
|
||||
|
||||
ServiceSessionId? boxed_id = id;
|
||||
session.set_data ("service-session-id", boxed_id);
|
||||
|
||||
session.close.connect (on_session_close);
|
||||
}
|
||||
|
||||
public ServiceSession link (ServiceSessionId id) throws Error {
|
||||
var session = sessions[id];
|
||||
if (session == null)
|
||||
throw new Error.INVALID_ARGUMENT ("Invalid session ID");
|
||||
return session;
|
||||
}
|
||||
|
||||
public void unlink (ServiceSessionId id) {
|
||||
ServiceSession? session;
|
||||
if (sessions.unset (id, out session)) {
|
||||
session.close.disconnect (on_session_close);
|
||||
|
||||
session_closed (id);
|
||||
}
|
||||
}
|
||||
|
||||
private void on_session_close (ServiceSession session) {
|
||||
ServiceSessionId? id = session.get_data ("service-session-id");
|
||||
unlink (id);
|
||||
}
|
||||
}
|
||||
}
|
||||
+116
-25
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
[DBus (name = "re.frida.HostSession16")]
|
||||
[DBus (name = "re.frida.HostSession17")]
|
||||
public interface HostSession : Object {
|
||||
public abstract async void ping (uint interval_seconds, Cancellable? cancellable) throws GLib.Error;
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace Frida {
|
||||
public abstract async InjectorPayloadId inject_library_blob (uint pid, uint8[] blob, string entrypoint, string data,
|
||||
Cancellable? cancellable) throws GLib.Error;
|
||||
|
||||
public abstract async ChannelId open_channel (string address, Cancellable? cancellable) throws GLib.Error;
|
||||
|
||||
public abstract async ServiceSessionId open_service (string address, Cancellable? cancellable) throws GLib.Error;
|
||||
|
||||
public signal void spawn_added (HostSpawnInfo info);
|
||||
public signal void spawn_removed (HostSpawnInfo info);
|
||||
public signal void child_added (HostChildInfo info);
|
||||
@@ -34,10 +38,12 @@ namespace Frida {
|
||||
public signal void process_crashed (CrashInfo crash);
|
||||
public signal void output (uint pid, int fd, uint8[] data);
|
||||
public signal void agent_session_detached (AgentSessionId id, SessionDetachReason reason, CrashInfo crash);
|
||||
public signal void channel_closed (ChannelId id);
|
||||
public signal void service_session_closed (ServiceSessionId id);
|
||||
public signal void uninjected (InjectorPayloadId id);
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.AgentSessionProvider16")]
|
||||
[DBus (name = "re.frida.AgentSessionProvider17")]
|
||||
public interface AgentSessionProvider : Object {
|
||||
public abstract async void open (AgentSessionId id, HashTable<string, Variant> options,
|
||||
Cancellable? cancellable) throws GLib.Error;
|
||||
@@ -52,7 +58,7 @@ namespace Frida {
|
||||
public signal void child_gating_changed (uint subscriber_count);
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.AgentSession16")]
|
||||
[DBus (name = "re.frida.AgentSession17")]
|
||||
public interface AgentSession : Object {
|
||||
public abstract async void close (Cancellable? cancellable) throws GLib.Error;
|
||||
|
||||
@@ -94,7 +100,7 @@ namespace Frida {
|
||||
public signal void candidate_gathering_done ();
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.AgentController16")]
|
||||
[DBus (name = "re.frida.AgentController17")]
|
||||
public interface AgentController : Object {
|
||||
#if !WINDOWS
|
||||
public abstract async HostChildId prepare_to_fork (uint parent_pid, Cancellable? cancellable, out uint parent_injectee_id,
|
||||
@@ -115,7 +121,7 @@ namespace Frida {
|
||||
Cancellable? cancellable) throws GLib.Error;
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.AgentMessageSink16")]
|
||||
[DBus (name = "re.frida.AgentMessageSink17")]
|
||||
public interface AgentMessageSink : Object {
|
||||
public abstract async void post_messages (AgentMessage[] messages, uint batch_id,
|
||||
Cancellable? cancellable) throws GLib.Error;
|
||||
@@ -145,7 +151,7 @@ namespace Frida {
|
||||
DEBUGGER
|
||||
}
|
||||
|
||||
public class AgentMessageTransmitter : Object {
|
||||
public sealed class AgentMessageTransmitter : Object {
|
||||
public signal void closed ();
|
||||
public signal void new_candidates (string[] candidate_sdps);
|
||||
public signal void candidate_gathering_done ();
|
||||
@@ -743,13 +749,30 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.TransportBroker16")]
|
||||
[DBus (name = "re.frida.Channel17")]
|
||||
public interface Channel : Object {
|
||||
public abstract async void close (Cancellable? cancellable) throws GLib.Error;
|
||||
public abstract async void input (uint8[] data, Cancellable? cancellable) throws GLib.Error;
|
||||
public signal void output (uint8[] data);
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.ServiceSession17")]
|
||||
public interface ServiceSession : Object {
|
||||
public signal void close ();
|
||||
public signal void message (Variant message);
|
||||
|
||||
public abstract async void activate (Cancellable? cancellable) throws GLib.Error;
|
||||
public abstract async void cancel (Cancellable? cancellable) throws GLib.Error;
|
||||
public abstract async Variant request (Variant parameters, Cancellable? cancellable) throws GLib.Error;
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.TransportBroker17")]
|
||||
public interface TransportBroker : Object {
|
||||
public abstract async void open_tcp_transport (AgentSessionId id, Cancellable? cancellable, out uint16 port,
|
||||
out string token) throws GLib.Error;
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.PortalSession16")]
|
||||
[DBus (name = "re.frida.PortalSession17")]
|
||||
public interface PortalSession : Object {
|
||||
public abstract async void join (HostApplicationInfo app, SpawnStartState current_state,
|
||||
AgentSessionId[] interrupted_sessions, HashTable<string, Variant> options, Cancellable? cancellable,
|
||||
@@ -758,19 +781,19 @@ namespace Frida {
|
||||
public signal void kill ();
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.BusSession16")]
|
||||
[DBus (name = "re.frida.BusSession17")]
|
||||
public interface BusSession : Object {
|
||||
public abstract async void attach (Cancellable? cancellable) throws GLib.Error;
|
||||
public abstract async void post (string json, bool has_data, uint8[] data, Cancellable? cancellable) throws GLib.Error;
|
||||
public signal void message (string json, bool has_data, uint8[] data);
|
||||
}
|
||||
|
||||
[DBus (name = "re.frida.AuthenticationService16")]
|
||||
[DBus (name = "re.frida.AuthenticationService17")]
|
||||
public interface AuthenticationService : Object {
|
||||
public abstract async string authenticate (string token, Cancellable? cancellable) throws GLib.Error;
|
||||
}
|
||||
|
||||
public class StaticAuthenticationService : Object, AuthenticationService {
|
||||
public sealed class StaticAuthenticationService : Object, AuthenticationService {
|
||||
public string token_hash {
|
||||
get;
|
||||
construct;
|
||||
@@ -795,13 +818,13 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class NullAuthenticationService : Object, AuthenticationService {
|
||||
public sealed class NullAuthenticationService : Object, AuthenticationService {
|
||||
public async string authenticate (string token, Cancellable? cancellable) throws Error, IOError {
|
||||
throw new Error.INVALID_OPERATION ("Authentication not expected");
|
||||
}
|
||||
}
|
||||
|
||||
public class UnauthorizedHostSession : Object, HostSession {
|
||||
public sealed class UnauthorizedHostSession : Object, HostSession {
|
||||
public async void ping (uint interval_seconds, Cancellable? cancellable) throws Error, IOError {
|
||||
throw_not_authorized ();
|
||||
}
|
||||
@@ -875,9 +898,17 @@ namespace Frida {
|
||||
Cancellable? cancellable) throws Error, IOError {
|
||||
throw_not_authorized ();
|
||||
}
|
||||
|
||||
public async ChannelId open_channel (string address, Cancellable? cancellable) throws Error, IOError {
|
||||
throw_not_authorized ();
|
||||
}
|
||||
|
||||
public async ServiceSessionId open_service (string address, Cancellable? cancellable) throws Error, IOError {
|
||||
throw_not_authorized ();
|
||||
}
|
||||
}
|
||||
|
||||
public class UnauthorizedPortalSession : Object, PortalSession {
|
||||
public sealed class UnauthorizedPortalSession : Object, PortalSession {
|
||||
public async void join (HostApplicationInfo app, SpawnStartState current_state,
|
||||
AgentSessionId[] interrupted_sessions, HashTable<string, Variant> options,
|
||||
Cancellable? cancellable, out SpawnStartState next_state) throws Error, IOError {
|
||||
@@ -885,7 +916,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class UnauthorizedBusSession : Object, BusSession {
|
||||
public sealed class UnauthorizedBusSession : Object, BusSession {
|
||||
public async void attach (Cancellable? cancellable) throws Error, IOError {
|
||||
throw_not_authorized ();
|
||||
}
|
||||
@@ -1083,7 +1114,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class FrontmostQueryOptions : Object {
|
||||
public sealed class FrontmostQueryOptions : Object {
|
||||
public Scope scope {
|
||||
get;
|
||||
set;
|
||||
@@ -1113,7 +1144,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationQueryOptions : Object {
|
||||
public sealed class ApplicationQueryOptions : Object {
|
||||
public Scope scope {
|
||||
get;
|
||||
set;
|
||||
@@ -1171,7 +1202,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class ProcessQueryOptions : Object {
|
||||
public sealed class ProcessQueryOptions : Object {
|
||||
public Scope scope {
|
||||
get;
|
||||
set;
|
||||
@@ -1313,7 +1344,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class SessionOptions : Object {
|
||||
public sealed class SessionOptions : Object {
|
||||
public Realm realm {
|
||||
get;
|
||||
set;
|
||||
@@ -1502,6 +1533,46 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public struct ChannelId {
|
||||
public string handle;
|
||||
|
||||
public ChannelId (string handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public ChannelId.generate () {
|
||||
this.handle = Uuid.string_random ().replace ("-", "");
|
||||
}
|
||||
|
||||
public static uint hash (ChannelId? id) {
|
||||
return id.handle.hash ();
|
||||
}
|
||||
|
||||
public static bool equal (ChannelId? a, ChannelId? b) {
|
||||
return a.handle == b.handle;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ServiceSessionId {
|
||||
public string handle;
|
||||
|
||||
public ServiceSessionId (string handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public ServiceSessionId.generate () {
|
||||
this.handle = Uuid.string_random ().replace ("-", "");
|
||||
}
|
||||
|
||||
public static uint hash (ServiceSessionId? id) {
|
||||
return id.handle.hash ();
|
||||
}
|
||||
|
||||
public static bool equal (ServiceSessionId? a, ServiceSessionId? b) {
|
||||
return a.handle == b.handle;
|
||||
}
|
||||
}
|
||||
|
||||
public struct AgentScriptId {
|
||||
public uint handle;
|
||||
|
||||
@@ -1518,7 +1589,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class ScriptOptions : Object {
|
||||
public sealed class ScriptOptions : Object {
|
||||
public string? name {
|
||||
get;
|
||||
set;
|
||||
@@ -1608,7 +1679,7 @@ namespace Frida {
|
||||
SHARED_MEMORY
|
||||
}
|
||||
|
||||
public class SnapshotOptions : Object {
|
||||
public sealed class SnapshotOptions : Object {
|
||||
public string? warmup_script {
|
||||
get;
|
||||
set;
|
||||
@@ -1683,7 +1754,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class PortalOptions : Object {
|
||||
public sealed class PortalOptions : Object {
|
||||
public TlsCertificate? certificate {
|
||||
get;
|
||||
set;
|
||||
@@ -1746,7 +1817,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class PeerOptions : Object {
|
||||
public sealed class PeerOptions : Object {
|
||||
public string? stun_server {
|
||||
get;
|
||||
set;
|
||||
@@ -1807,7 +1878,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class Relay : Object {
|
||||
public sealed class Relay : Object {
|
||||
public string address {
|
||||
get;
|
||||
construct;
|
||||
@@ -2048,7 +2119,8 @@ namespace Frida {
|
||||
public const string AGENT_SESSION = "/re/frida/AgentSession";
|
||||
public const string AGENT_CONTROLLER = "/re/frida/AgentController";
|
||||
public const string AGENT_MESSAGE_SINK = "/re/frida/AgentMessageSink";
|
||||
public const string CHILD_SESSION = "/re/frida/ChildSession";
|
||||
public const string CHANNEL = "/re/frida/Channel";
|
||||
public const string SERVICE = "/re/frida/Service";
|
||||
public const string TRANSPORT_BROKER = "/re/frida/TransportBroker";
|
||||
public const string PORTAL_SESSION = "/re/frida/PortalSession";
|
||||
public const string BUS_SESSION = "/re/frida/BusSession";
|
||||
@@ -2061,6 +2133,14 @@ namespace Frida {
|
||||
public static string for_agent_message_sink (AgentSessionId id) {
|
||||
return AGENT_MESSAGE_SINK + "/" + id.handle;
|
||||
}
|
||||
|
||||
public static string for_channel (ChannelId id) {
|
||||
return CHANNEL + "/" + id.handle;
|
||||
}
|
||||
|
||||
public static string for_service_session (ServiceSessionId id) {
|
||||
return SERVICE + "/" + id.handle;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Marshal {
|
||||
@@ -2079,6 +2159,17 @@ namespace Frida {
|
||||
}
|
||||
|
||||
namespace Numeric {
|
||||
public uint int64_hash (int64? val) {
|
||||
uint64 v = (uint64) val.abs ();
|
||||
return (uint) ((v >> 32) ^ (v & 0xffffffffU));
|
||||
}
|
||||
|
||||
public bool int64_equal (int64? val_a, int64? val_b) {
|
||||
int64 a = val_a;
|
||||
int64 b = val_b;
|
||||
return a == b;
|
||||
}
|
||||
|
||||
public uint uint64_hash (uint64? val) {
|
||||
uint64 v = val;
|
||||
return (uint) ((v >> 32) ^ (v & 0xffffffffU));
|
||||
|
||||
+610
-587
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,336 @@
|
||||
namespace Frida {
|
||||
public abstract class VirtualStream : IOStream {
|
||||
public override InputStream input_stream {
|
||||
get {
|
||||
return _input_stream;
|
||||
}
|
||||
}
|
||||
|
||||
public override OutputStream output_stream {
|
||||
get {
|
||||
return _output_stream;
|
||||
}
|
||||
}
|
||||
|
||||
public IOCondition pending_io {
|
||||
get {
|
||||
lock (state)
|
||||
return _pending_io;
|
||||
}
|
||||
}
|
||||
|
||||
protected State state = OPEN;
|
||||
|
||||
private VirtualInputStream _input_stream;
|
||||
private VirtualOutputStream _output_stream;
|
||||
|
||||
private IOCondition _pending_io;
|
||||
|
||||
private Gee.Map<unowned Source, IOCondition> sources = new Gee.HashMap<unowned Source, IOCondition> ();
|
||||
|
||||
protected Cancellable io_cancellable = new Cancellable ();
|
||||
|
||||
protected MainContext main_context;
|
||||
|
||||
protected enum State {
|
||||
CREATED,
|
||||
OPENING,
|
||||
OPEN,
|
||||
CLOSED
|
||||
}
|
||||
|
||||
protected delegate void WorkFunc ();
|
||||
|
||||
construct {
|
||||
_input_stream = new VirtualInputStream (this);
|
||||
_output_stream = new VirtualOutputStream (this);
|
||||
|
||||
main_context = MainContext.ref_thread_default ();
|
||||
|
||||
state = query_initial_state ();
|
||||
_pending_io = query_events ();
|
||||
}
|
||||
|
||||
public override void dispose () {
|
||||
_output_stream.detach ();
|
||||
_input_stream.detach ();
|
||||
|
||||
io_cancellable.cancel ();
|
||||
|
||||
base.dispose ();
|
||||
}
|
||||
|
||||
protected virtual State query_initial_state () {
|
||||
return OPEN;
|
||||
}
|
||||
|
||||
protected abstract IOCondition query_events ();
|
||||
|
||||
public override bool close (GLib.Cancellable? cancellable) throws IOError {
|
||||
_close ();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool close_async (int io_priority, GLib.Cancellable? cancellable) throws IOError {
|
||||
_close ();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _close () {
|
||||
if (main_context.is_owner ()) {
|
||||
do_close ();
|
||||
} else {
|
||||
var source = new IdleSource ();
|
||||
source.set_callback (() => {
|
||||
do_close ();
|
||||
return Source.REMOVE;
|
||||
});
|
||||
source.attach (main_context);
|
||||
}
|
||||
}
|
||||
|
||||
private void do_close () {
|
||||
if (state == CLOSED)
|
||||
return;
|
||||
|
||||
handle_close ();
|
||||
}
|
||||
|
||||
protected abstract void handle_close ();
|
||||
|
||||
public virtual void shutdown_read () throws IOError {
|
||||
}
|
||||
|
||||
public virtual void shutdown_write () throws IOError {
|
||||
}
|
||||
|
||||
public abstract ssize_t read (uint8[] buffer) throws IOError;
|
||||
|
||||
public abstract ssize_t write (uint8[] buffer) throws IOError;
|
||||
|
||||
protected void with_state_lock (WorkFunc func) {
|
||||
lock (state)
|
||||
func ();
|
||||
}
|
||||
|
||||
public void register_source (Source source, IOCondition condition) {
|
||||
lock (state)
|
||||
sources[source] = condition | IOCondition.ERR | IOCondition.HUP;
|
||||
}
|
||||
|
||||
public void unregister_source (Source source) {
|
||||
lock (state)
|
||||
sources.unset (source);
|
||||
}
|
||||
|
||||
protected virtual void update_pending_io () {
|
||||
lock (state) {
|
||||
_pending_io = query_events ();
|
||||
|
||||
foreach (var entry in sources.entries) {
|
||||
unowned Source source = entry.key;
|
||||
IOCondition c = entry.value;
|
||||
if ((_pending_io & c) != 0)
|
||||
source.set_ready_time (0);
|
||||
}
|
||||
}
|
||||
|
||||
notify_property ("pending-io");
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class VirtualInputStream : InputStream, PollableInputStream {
|
||||
private weak VirtualStream stream;
|
||||
|
||||
public VirtualInputStream (VirtualStream stream) {
|
||||
Object ();
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
internal void detach () {
|
||||
stream = null;
|
||||
}
|
||||
|
||||
public override bool close (Cancellable? cancellable) throws IOError {
|
||||
if (stream != null)
|
||||
stream.shutdown_read ();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool close_async (int io_priority, Cancellable? cancellable) throws GLib.IOError {
|
||||
return close (cancellable);
|
||||
}
|
||||
|
||||
public override ssize_t read (uint8[] buffer, Cancellable? cancellable) throws IOError {
|
||||
if (stream == null)
|
||||
return 0;
|
||||
|
||||
if (!is_readable ()) {
|
||||
bool done = false;
|
||||
var mutex = Mutex ();
|
||||
var cond = Cond ();
|
||||
|
||||
ulong io_handler = stream.notify["pending-io"].connect ((obj, pspec) => {
|
||||
if (is_readable ()) {
|
||||
mutex.lock ();
|
||||
done = true;
|
||||
cond.signal ();
|
||||
mutex.unlock ();
|
||||
}
|
||||
});
|
||||
ulong cancellation_handler = 0;
|
||||
if (cancellable != null) {
|
||||
cancellation_handler = cancellable.connect (() => {
|
||||
mutex.lock ();
|
||||
done = true;
|
||||
cond.signal ();
|
||||
mutex.unlock ();
|
||||
});
|
||||
}
|
||||
|
||||
if (!is_readable ()) {
|
||||
mutex.lock ();
|
||||
while (!done)
|
||||
cond.wait (mutex);
|
||||
mutex.unlock ();
|
||||
}
|
||||
|
||||
if (cancellation_handler != 0)
|
||||
cancellable.disconnect (cancellation_handler);
|
||||
stream.disconnect (io_handler);
|
||||
|
||||
cancellable.set_error_if_cancelled ();
|
||||
}
|
||||
|
||||
return stream.read (buffer);
|
||||
}
|
||||
|
||||
public bool can_poll () {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool is_readable () {
|
||||
if (stream == null)
|
||||
return true;
|
||||
return (stream.pending_io & IOCondition.IN) != 0;
|
||||
}
|
||||
|
||||
public PollableSource create_source (Cancellable? cancellable) {
|
||||
return new PollableSource.full (this, new VirtualIOSource (stream, IOCondition.IN), cancellable);
|
||||
}
|
||||
|
||||
public ssize_t read_nonblocking_fn (uint8[] buffer) throws GLib.Error {
|
||||
if (stream == null)
|
||||
return 0;
|
||||
return stream.read (buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class VirtualOutputStream : OutputStream, PollableOutputStream {
|
||||
private weak VirtualStream? stream;
|
||||
|
||||
public VirtualOutputStream (VirtualStream stream) {
|
||||
Object ();
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
internal void detach () {
|
||||
stream = null;
|
||||
}
|
||||
|
||||
public override bool close (Cancellable? cancellable) throws IOError {
|
||||
if (stream != null)
|
||||
stream.shutdown_write ();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool close_async (int io_priority, Cancellable? cancellable) throws GLib.IOError {
|
||||
return close (cancellable);
|
||||
}
|
||||
|
||||
public override bool flush (GLib.Cancellable? cancellable) throws GLib.Error {
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async bool flush_async (int io_priority, GLib.Cancellable? cancellable) throws GLib.Error {
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ssize_t write (uint8[] buffer, Cancellable? cancellable) throws IOError {
|
||||
return stream.write (buffer);
|
||||
}
|
||||
|
||||
public bool can_poll () {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool is_writable () {
|
||||
if (stream == null)
|
||||
return false;
|
||||
return (stream.pending_io & IOCondition.OUT) != 0;
|
||||
}
|
||||
|
||||
public PollableSource create_source (Cancellable? cancellable) {
|
||||
return new PollableSource.full (this, new VirtualIOSource (stream, IOCondition.OUT), cancellable);
|
||||
}
|
||||
|
||||
public ssize_t write_nonblocking_fn (uint8[]? buffer) throws GLib.Error {
|
||||
if (stream == null)
|
||||
throw new IOError.CLOSED ("Virtual is closed");
|
||||
return stream.write (buffer);
|
||||
}
|
||||
|
||||
public PollableReturn writev_nonblocking_fn (OutputVector[] vectors, out size_t bytes_written) throws GLib.Error {
|
||||
assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
private class VirtualIOSource : Source {
|
||||
public VirtualStream? stream;
|
||||
public IOCondition condition;
|
||||
|
||||
public VirtualIOSource (VirtualStream stream, IOCondition condition) {
|
||||
this.stream = stream;
|
||||
this.condition = condition;
|
||||
|
||||
if (stream != null)
|
||||
stream.register_source (this, condition);
|
||||
}
|
||||
|
||||
~VirtualIOSource () {
|
||||
if (stream != null)
|
||||
stream.unregister_source (this);
|
||||
}
|
||||
|
||||
protected override bool prepare (out int timeout) {
|
||||
timeout = -1;
|
||||
return is_ready ();
|
||||
}
|
||||
|
||||
protected override bool check () {
|
||||
return is_ready ();
|
||||
}
|
||||
|
||||
private bool is_ready () {
|
||||
IOCondition pending_io = (stream != null) ? stream.pending_io : IOCondition.IN;
|
||||
return (pending_io & condition) != 0;
|
||||
}
|
||||
|
||||
protected override bool dispatch (SourceFunc? callback) {
|
||||
set_ready_time (-1);
|
||||
|
||||
if (callback == null)
|
||||
return Source.REMOVE;
|
||||
|
||||
return callback ();
|
||||
}
|
||||
|
||||
protected static bool closure_callback (Closure closure) {
|
||||
var return_value = Value (typeof (bool));
|
||||
|
||||
closure.invoke (ref return_value, {});
|
||||
|
||||
return return_value.get_boolean ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
namespace Frida {
|
||||
public interface ObjectBuilder : Object {
|
||||
public abstract unowned ObjectBuilder begin_dictionary ();
|
||||
public abstract unowned ObjectBuilder set_member_name (string name);
|
||||
public abstract unowned ObjectBuilder end_dictionary ();
|
||||
|
||||
public abstract unowned ObjectBuilder begin_array ();
|
||||
public abstract unowned ObjectBuilder end_array ();
|
||||
|
||||
public abstract unowned ObjectBuilder add_null_value ();
|
||||
public abstract unowned ObjectBuilder add_bool_value (bool val);
|
||||
public abstract unowned ObjectBuilder add_int64_value (int64 val);
|
||||
public abstract unowned ObjectBuilder add_uint64_value (uint64 val);
|
||||
public abstract unowned ObjectBuilder add_data_value (Bytes val);
|
||||
public abstract unowned ObjectBuilder add_string_value (string val);
|
||||
public abstract unowned ObjectBuilder add_uuid_value (uint8[] val);
|
||||
public abstract unowned ObjectBuilder add_raw_value (Bytes val);
|
||||
|
||||
public abstract Bytes build ();
|
||||
}
|
||||
|
||||
public interface ObjectReader : Object {
|
||||
public abstract bool has_member (string name) throws Error;
|
||||
public abstract unowned ObjectReader read_member (string name) throws Error;
|
||||
public abstract unowned ObjectReader end_member ();
|
||||
|
||||
public abstract uint count_elements () throws Error;
|
||||
public abstract unowned ObjectReader read_element (uint index) throws Error;
|
||||
public abstract unowned ObjectReader end_element () throws Error;
|
||||
|
||||
public abstract bool get_bool_value () throws Error;
|
||||
public abstract uint8 get_uint8_value () throws Error;
|
||||
public abstract uint16 get_uint16_value () throws Error;
|
||||
public abstract int64 get_int64_value () throws Error;
|
||||
public abstract uint64 get_uint64_value () throws Error;
|
||||
public abstract Bytes get_data_value () throws Error;
|
||||
public abstract unowned string get_string_value () throws Error;
|
||||
public abstract unowned string get_uuid_value () throws Error;
|
||||
}
|
||||
|
||||
public sealed class VariantReader : Object, ObjectReader {
|
||||
public Variant root_object {
|
||||
get {
|
||||
return scopes.peek_head ().val;
|
||||
}
|
||||
}
|
||||
|
||||
public Variant current_object {
|
||||
get {
|
||||
return scopes.peek_tail ().val;
|
||||
}
|
||||
}
|
||||
|
||||
private Gee.Deque<Scope> scopes = new Gee.ArrayQueue<Scope> ();
|
||||
|
||||
public VariantReader (Variant v) {
|
||||
push_scope (v);
|
||||
}
|
||||
|
||||
public bool has_member (string name) throws Error {
|
||||
var scope = peek_scope ();
|
||||
if (scope.dict == null)
|
||||
throw new Error.PROTOCOL ("Dictionary expected, but at %s", scope.val.print (true));
|
||||
return scope.dict.contains (name);
|
||||
}
|
||||
|
||||
public unowned ObjectReader read_member (string name) throws Error {
|
||||
var scope = peek_scope ();
|
||||
if (scope.dict == null)
|
||||
throw new Error.PROTOCOL ("Dictionary expected, but at %s", scope.val.print (true));
|
||||
|
||||
Variant? v = scope.dict.lookup_value (name, null);
|
||||
if (v == null)
|
||||
throw new Error.PROTOCOL ("Key '%s' not found in dictionary: %s", name, scope.val.print (true));
|
||||
|
||||
push_scope (v);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectReader end_member () {
|
||||
pop_scope ();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public uint count_elements () throws Error {
|
||||
var scope = peek_scope ();
|
||||
scope.check_array ();
|
||||
return (uint) scope.val.n_children ();
|
||||
}
|
||||
|
||||
public unowned ObjectReader read_element (uint index) throws Error {
|
||||
var scope = peek_scope ();
|
||||
scope.check_array ();
|
||||
push_scope (scope.val.get_child_value (index).get_variant ());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectReader end_element () throws Error {
|
||||
pop_scope ();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool get_bool_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.BOOLEAN).get_boolean ();
|
||||
}
|
||||
|
||||
public uint8 get_uint8_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.BYTE).get_byte ();
|
||||
}
|
||||
|
||||
public uint16 get_uint16_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.UINT16).get_uint16 ();
|
||||
}
|
||||
|
||||
public int64 get_int64_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.INT64).get_int64 ();
|
||||
}
|
||||
|
||||
public uint64 get_uint64_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.UINT64).get_uint64 ();
|
||||
}
|
||||
|
||||
public Bytes get_data_value () throws Error {
|
||||
return peek_scope ().get_value (new VariantType.array (VariantType.BYTE)).get_data_as_bytes ();
|
||||
}
|
||||
|
||||
public unowned string get_string_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.STRING).get_string ();
|
||||
}
|
||||
|
||||
public unowned string get_uuid_value () throws Error {
|
||||
return peek_scope ().get_value (VariantType.STRING).get_string (); // TODO: Use a tuple to avoid ambiguity.
|
||||
}
|
||||
|
||||
private void push_scope (Variant v) {
|
||||
scopes.offer_tail (new Scope (v));
|
||||
}
|
||||
|
||||
private Scope peek_scope () {
|
||||
return scopes.peek_tail ();
|
||||
}
|
||||
|
||||
private Scope pop_scope () {
|
||||
return scopes.poll_tail ();
|
||||
}
|
||||
|
||||
private class Scope {
|
||||
public Variant val;
|
||||
public VariantDict? dict;
|
||||
public bool is_array = false;
|
||||
|
||||
public Scope (Variant v) {
|
||||
val = v;
|
||||
|
||||
VariantType t = v.get_type ();
|
||||
if (t.equal (VariantType.VARDICT))
|
||||
dict = new VariantDict (v);
|
||||
else if (t.is_subtype_of (VariantType.ARRAY))
|
||||
is_array = true;
|
||||
}
|
||||
|
||||
public Variant get_value (VariantType expected_type) throws Error {
|
||||
if (!val.get_type ().equal (expected_type)) {
|
||||
throw new Error.PROTOCOL ("Expected type '%s', got '%s'",
|
||||
(string) expected_type.peek_string (),
|
||||
(string) val.get_type ().peek_string ());
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public void check_array () throws Error {
|
||||
if (!is_array)
|
||||
throw new Error.PROTOCOL ("Array expected, but at %s", val.print (true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class JsonObjectBuilder : Object, ObjectBuilder {
|
||||
private Json.Builder builder = new Json.Builder ();
|
||||
private Gee.Map<string, Bytes> raw_values = new Gee.HashMap<string, Bytes> ();
|
||||
|
||||
public unowned ObjectBuilder begin_dictionary () {
|
||||
builder.begin_object ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder set_member_name (string name) {
|
||||
builder.set_member_name (name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder end_dictionary () {
|
||||
builder.end_object ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder begin_array () {
|
||||
builder.begin_array ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder end_array () {
|
||||
builder.end_array ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_null_value () {
|
||||
builder.add_null_value ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_bool_value (bool val) {
|
||||
builder.add_boolean_value (val);
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_int64_value (int64 val) {
|
||||
builder.add_int_value (val);
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_uint64_value (uint64 val) {
|
||||
builder.add_int_value ((int64) val);
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_data_value (Bytes val) {
|
||||
builder.add_string_value (Base64.encode (val.get_data ()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_string_value (string val) {
|
||||
builder.add_string_value (val);
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_uuid_value (uint8[] val) {
|
||||
assert_not_reached ();
|
||||
}
|
||||
|
||||
public unowned ObjectBuilder add_raw_value (Bytes val) {
|
||||
string uuid = Uuid.string_random ();
|
||||
builder.add_string_value (uuid);
|
||||
raw_values[uuid] = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Bytes build () {
|
||||
string json = Json.to_string (builder.get_root (), false);
|
||||
|
||||
foreach (var e in raw_values.entries) {
|
||||
unowned string uuid = e.key;
|
||||
Bytes val = e.value;
|
||||
|
||||
unowned string raw_str = (string) val.get_data ();
|
||||
string str = raw_str[:(long) val.get_size ()];
|
||||
|
||||
json = json.replace ("\"" + uuid + "\"", str);
|
||||
}
|
||||
|
||||
return new Bytes (json.data);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class JsonObjectReader : Object, ObjectReader {
|
||||
private Json.Reader reader;
|
||||
|
||||
public JsonObjectReader (string json) throws Error {
|
||||
try {
|
||||
reader = new Json.Reader (Json.from_string (json));
|
||||
} catch (GLib.Error e) {
|
||||
throw new Error.INVALID_ARGUMENT ("%s", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public bool has_member (string name) throws Error {
|
||||
bool result = reader.read_member (name);
|
||||
reader.end_member ();
|
||||
return result;
|
||||
}
|
||||
|
||||
public unowned ObjectReader read_member (string name) throws Error {
|
||||
if (!reader.read_member (name))
|
||||
throw_dict_access_error ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectReader end_member () {
|
||||
reader.end_member ();
|
||||
return this;
|
||||
}
|
||||
|
||||
[NoReturn]
|
||||
private void throw_dict_access_error () throws Error {
|
||||
GLib.Error e = reader.get_error ();
|
||||
reader.end_member ();
|
||||
throw new Error.PROTOCOL ("%s", e.message);
|
||||
}
|
||||
|
||||
public uint count_elements () throws Error {
|
||||
int n = reader.count_elements ();
|
||||
if (n == -1)
|
||||
throw_array_access_error ();
|
||||
return n;
|
||||
}
|
||||
|
||||
public unowned ObjectReader read_element (uint index) throws Error {
|
||||
if (!reader.read_element (index)) {
|
||||
GLib.Error e = reader.get_error ();
|
||||
reader.end_element ();
|
||||
throw new Error.PROTOCOL ("%s", e.message);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned ObjectReader end_element () throws Error {
|
||||
reader.end_element ();
|
||||
return this;
|
||||
}
|
||||
|
||||
[NoReturn]
|
||||
private void throw_array_access_error () throws Error {
|
||||
GLib.Error e = reader.get_error ();
|
||||
reader.end_element ();
|
||||
throw new Error.PROTOCOL ("%s", e.message);
|
||||
}
|
||||
|
||||
public bool get_bool_value () throws Error {
|
||||
bool v = reader.get_boolean_value ();
|
||||
if (!v)
|
||||
maybe_throw_value_access_error ();
|
||||
return v;
|
||||
}
|
||||
|
||||
public uint8 get_uint8_value () throws Error {
|
||||
int64 v = get_int64_value ();
|
||||
if (v < 0 || v > uint8.MAX)
|
||||
throw new Error.PROTOCOL ("Invalid uint8");
|
||||
return (uint8) v;
|
||||
}
|
||||
|
||||
public uint16 get_uint16_value () throws Error {
|
||||
int64 v = get_int64_value ();
|
||||
if (v < 0 || v > uint16.MAX)
|
||||
throw new Error.PROTOCOL ("Invalid uint16");
|
||||
return (uint16) v;
|
||||
}
|
||||
|
||||
public int64 get_int64_value () throws Error {
|
||||
int64 v = reader.get_int_value ();
|
||||
if (v == 0)
|
||||
maybe_throw_value_access_error ();
|
||||
return v;
|
||||
}
|
||||
|
||||
public uint64 get_uint64_value () throws Error {
|
||||
int64 v = get_int64_value ();
|
||||
if (v < 0)
|
||||
throw new Error.PROTOCOL ("Invalid uint64");
|
||||
return v;
|
||||
}
|
||||
|
||||
public Bytes get_data_value () throws Error {
|
||||
return new Bytes (Base64.decode (get_string_value ()));
|
||||
}
|
||||
|
||||
public unowned string get_string_value () throws Error {
|
||||
unowned string? v = reader.get_string_value ();
|
||||
if (v == null)
|
||||
maybe_throw_value_access_error ();
|
||||
return v;
|
||||
}
|
||||
|
||||
public unowned string get_uuid_value () throws Error {
|
||||
return get_string_value ();
|
||||
}
|
||||
|
||||
private void maybe_throw_value_access_error () throws Error {
|
||||
GLib.Error? e = reader.get_error ();
|
||||
if (e == null)
|
||||
return;
|
||||
reader.end_member ();
|
||||
throw new Error.PROTOCOL ("%s", e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
namespace Frida {
|
||||
public sealed class XpcClient : Object {
|
||||
public signal void message (Darwin.Xpc.Object obj);
|
||||
|
||||
public State state {
|
||||
get {
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
public Darwin.Xpc.Connection connection {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
public Darwin.GCD.DispatchQueue queue {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
private State _state;
|
||||
private string? close_reason;
|
||||
private MainContext main_context;
|
||||
|
||||
public enum State {
|
||||
OPEN,
|
||||
CLOSING,
|
||||
CLOSED,
|
||||
}
|
||||
|
||||
public static XpcClient make_for_mach_service (string name, Darwin.GCD.DispatchQueue queue) {
|
||||
return new XpcClient (Darwin.Xpc.Connection.create_mach_service (name, queue, 0), queue);
|
||||
}
|
||||
|
||||
public XpcClient (Darwin.Xpc.Connection connection, Darwin.GCD.DispatchQueue queue) {
|
||||
Object (connection: connection, queue: queue);
|
||||
}
|
||||
|
||||
construct {
|
||||
main_context = MainContext.ref_thread_default ();
|
||||
|
||||
connection.set_event_handler (on_event);
|
||||
connection.activate ();
|
||||
}
|
||||
|
||||
public override void dispose () {
|
||||
if (close_reason != null) {
|
||||
change_state (CLOSED);
|
||||
} else {
|
||||
change_state (CLOSING);
|
||||
this.ref ();
|
||||
connection.cancel ();
|
||||
}
|
||||
|
||||
base.dispose ();
|
||||
}
|
||||
|
||||
public async Darwin.Xpc.Object request (Darwin.Xpc.Object message, Cancellable? cancellable) throws Error, IOError {
|
||||
Darwin.Xpc.Object? reply = null;
|
||||
connection.send_message_with_reply (message, queue, r => {
|
||||
schedule_on_frida_thread (() => {
|
||||
reply = r;
|
||||
request.callback ();
|
||||
return Source.REMOVE;
|
||||
});
|
||||
});
|
||||
|
||||
var cancel_source = new CancellableSource (cancellable);
|
||||
cancel_source.set_callback (() => {
|
||||
connection.cancel ();
|
||||
return Source.REMOVE;
|
||||
});
|
||||
cancel_source.attach (main_context);
|
||||
|
||||
yield;
|
||||
|
||||
cancel_source.destroy ();
|
||||
|
||||
if (reply.type == Darwin.Xpc.Error.TYPE) {
|
||||
var e = (Darwin.Xpc.Error) reply;
|
||||
throw new Error.NOT_SUPPORTED ("%s", e.get_string (Darwin.Xpc.Error.KEY_DESCRIPTION));
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
public void post (Darwin.Xpc.Object message) throws Error, IOError {
|
||||
connection.send_message (message);
|
||||
}
|
||||
|
||||
private void change_state (State new_state) {
|
||||
_state = new_state;
|
||||
notify_property ("state");
|
||||
}
|
||||
|
||||
private void on_event (Darwin.Xpc.Object obj) {
|
||||
schedule_on_frida_thread (() => {
|
||||
if (obj.type == Darwin.Xpc.Error.TYPE) {
|
||||
var e = (Darwin.Xpc.Error) obj;
|
||||
close_reason = e.get_string (Darwin.Xpc.Error.KEY_DESCRIPTION);
|
||||
switch (state) {
|
||||
case OPEN:
|
||||
change_state (CLOSED);
|
||||
break;
|
||||
case CLOSING:
|
||||
change_state (CLOSED);
|
||||
unref ();
|
||||
break;
|
||||
case CLOSED:
|
||||
assert_not_reached ();
|
||||
}
|
||||
} else {
|
||||
message (obj);
|
||||
}
|
||||
return Source.REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
private void schedule_on_frida_thread (owned SourceFunc function) {
|
||||
var source = new IdleSource ();
|
||||
source.set_callback ((owned) function);
|
||||
source.attach (main_context);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class XpcObjectReader {
|
||||
public Darwin.Xpc.Object root_object {
|
||||
get {
|
||||
return scopes.peek_head ().object;
|
||||
}
|
||||
}
|
||||
|
||||
public Darwin.Xpc.Object current_object {
|
||||
get {
|
||||
return scopes.peek_tail ().object;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate int TranslateErrorFunc (string domain, int code, string description);
|
||||
|
||||
private Gee.Deque<Scope> scopes = new Gee.ArrayQueue<Scope> ();
|
||||
|
||||
public XpcObjectReader (Darwin.Xpc.Object obj) {
|
||||
push_scope (obj);
|
||||
}
|
||||
|
||||
public bool has_member (string name) throws Error {
|
||||
return peek_scope ().get_dictionary ().get_value (name) != null;
|
||||
}
|
||||
|
||||
public bool try_read_member (string name) throws Error {
|
||||
var scope = peek_scope ();
|
||||
var dict = scope.get_dictionary ();
|
||||
var val = dict.get_value (name);
|
||||
if (val == null)
|
||||
return false;
|
||||
|
||||
push_scope (val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public unowned XpcObjectReader read_member (string name) throws Error {
|
||||
var scope = peek_scope ();
|
||||
var dict = scope.get_dictionary ();
|
||||
var val = dict.get_value (name);
|
||||
if (val == null)
|
||||
throw new Error.PROTOCOL ("Key '%s' not found in dictionary: %s", name, scope.object.to_string ());
|
||||
|
||||
push_scope (val);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned XpcObjectReader end_member () {
|
||||
pop_scope ();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public size_t count_elements () throws Error {
|
||||
return peek_scope ().get_array ().count;
|
||||
}
|
||||
|
||||
public unowned XpcObjectReader read_element (size_t index) throws Error {
|
||||
push_scope (peek_scope ().get_array ().get_value (index));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public unowned XpcObjectReader end_element () throws Error {
|
||||
pop_scope ();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool get_bool_value () throws Error {
|
||||
return peek_scope ().get_object<Darwin.Xpc.Bool> (Darwin.Xpc.Bool.TYPE).get_value ();
|
||||
}
|
||||
|
||||
public int64 get_int64_value () throws Error {
|
||||
return peek_scope ().get_object<Darwin.Xpc.Int64> (Darwin.Xpc.Int64.TYPE).get_value ();
|
||||
}
|
||||
|
||||
public uint64 get_uint64_value () throws Error {
|
||||
return peek_scope ().get_object<Darwin.Xpc.UInt64> (Darwin.Xpc.UInt64.TYPE).get_value ();
|
||||
}
|
||||
|
||||
public unowned uint8[] get_data_value () throws Error {
|
||||
var data = peek_scope ().get_object<Darwin.Xpc.Data> (Darwin.Xpc.Data.TYPE);
|
||||
unowned uint8[] buf = (uint8[]) data.get_bytes_ptr ();
|
||||
buf.length = (int) data.get_length ();
|
||||
return buf;
|
||||
}
|
||||
|
||||
public unowned string get_string_value () throws Error {
|
||||
return peek_scope ().get_object<Darwin.Xpc.String> (Darwin.Xpc.String.TYPE).get_string_ptr ();
|
||||
}
|
||||
|
||||
public unowned uint8[] get_uuid_value () throws Error {
|
||||
return peek_scope ().get_object<Darwin.Xpc.Uuid> (Darwin.Xpc.Uuid.TYPE).get_bytes ()[:16];
|
||||
}
|
||||
|
||||
public unowned string get_error_description () throws Error {
|
||||
var error = peek_scope ().get_object<Darwin.Xpc.Error> (Darwin.Xpc.Error.TYPE);
|
||||
return error.get_string (Darwin.Xpc.Error.KEY_DESCRIPTION);
|
||||
}
|
||||
|
||||
public void check_nserror (TranslateErrorFunc translate_error) throws Error {
|
||||
if (!has_member ("error"))
|
||||
return;
|
||||
|
||||
read_member ("error");
|
||||
|
||||
unowned string domain = read_member ("domain").get_string_value ();
|
||||
end_member ();
|
||||
|
||||
var code = (int) read_member ("code").get_int64_value ();
|
||||
end_member ();
|
||||
|
||||
string description = read_member ("userInfo").read_member ("NSLocalizedDescription").get_string_value ();
|
||||
if (description.has_suffix ("."))
|
||||
description = description[:description.length - 1];
|
||||
|
||||
throw (Error) new GLib.Error.literal (
|
||||
Quark.from_string ("frida-error-quark"),
|
||||
translate_error (domain, code, description),
|
||||
description);
|
||||
}
|
||||
|
||||
public unowned Darwin.Xpc.Object get_object_value (Darwin.Xpc.Type expected_type) throws Error {
|
||||
return peek_scope ().get_object<Darwin.Xpc.Object> (expected_type);
|
||||
}
|
||||
|
||||
private void push_scope (Darwin.Xpc.Object obj) {
|
||||
scopes.offer_tail (new Scope (obj));
|
||||
}
|
||||
|
||||
private Scope peek_scope () {
|
||||
return scopes.peek_tail ();
|
||||
}
|
||||
|
||||
private Scope pop_scope () {
|
||||
return scopes.poll_tail ();
|
||||
}
|
||||
|
||||
private class Scope {
|
||||
public Darwin.Xpc.Object object;
|
||||
private unowned Darwin.Xpc.Type type;
|
||||
|
||||
public Scope (Darwin.Xpc.Object obj) {
|
||||
object = obj;
|
||||
type = obj.type;
|
||||
}
|
||||
|
||||
public unowned T get_object<T> (Darwin.Xpc.Type expected_type) throws Error {
|
||||
if (type != expected_type)
|
||||
throw new Error.PROTOCOL ("Expected type '%s', got '%s'", expected_type.name, type.name);
|
||||
return object;
|
||||
}
|
||||
|
||||
public unowned Darwin.Xpc.Array get_array () throws Error {
|
||||
return get_object<Darwin.Xpc.Array> (Darwin.Xpc.Array.TYPE);
|
||||
}
|
||||
|
||||
public unowned Darwin.Xpc.Dictionary get_dictionary () throws Error {
|
||||
return get_object<Darwin.Xpc.Dictionary> (Darwin.Xpc.Dictionary.TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+88
-26
@@ -1,5 +1,5 @@
|
||||
namespace Frida.Gadget {
|
||||
private class Config : Object, Json.Serializable {
|
||||
private sealed class Config : Object, Json.Serializable {
|
||||
public Object interaction {
|
||||
get;
|
||||
set;
|
||||
@@ -93,7 +93,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ScriptInteraction : Object, Json.Serializable {
|
||||
private sealed class ScriptInteraction : Object, Json.Serializable {
|
||||
public string path {
|
||||
get;
|
||||
set;
|
||||
@@ -145,7 +145,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ScriptDirectoryInteraction : Object {
|
||||
private sealed class ScriptDirectoryInteraction : Object {
|
||||
public string path {
|
||||
get;
|
||||
set;
|
||||
@@ -164,7 +164,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ScriptConfig : Object, Json.Serializable {
|
||||
private sealed class ScriptConfig : Object, Json.Serializable {
|
||||
public ProcessFilter? filter {
|
||||
get;
|
||||
set;
|
||||
@@ -216,7 +216,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ProcessFilter : Object {
|
||||
private sealed class ProcessFilter : Object {
|
||||
public string[] executables {
|
||||
get;
|
||||
set;
|
||||
@@ -258,7 +258,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ListenInteraction : SocketInteraction {
|
||||
private sealed class ListenInteraction : SocketInteraction {
|
||||
public PortConflictBehavior on_port_conflict {
|
||||
get;
|
||||
set;
|
||||
@@ -287,7 +287,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ConnectInteraction : SocketInteraction, Json.Serializable {
|
||||
private sealed class ConnectInteraction : SocketInteraction, Json.Serializable {
|
||||
public string[]? acl {
|
||||
get;
|
||||
set;
|
||||
@@ -328,7 +328,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class Location : Object {
|
||||
private sealed class Location : Object {
|
||||
public string executable_name {
|
||||
get;
|
||||
construct;
|
||||
@@ -751,7 +751,7 @@ namespace Frida.Gadget {
|
||||
|
||||
string config_data;
|
||||
try {
|
||||
FileUtils.get_contents (config_path, out config_data);
|
||||
load_asset_text (config_path, out config_data);
|
||||
} catch (FileError e) {
|
||||
if (e is FileError.NOENT)
|
||||
return new Config ();
|
||||
@@ -988,7 +988,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ScriptRunner : BaseController {
|
||||
private sealed class ScriptRunner : BaseController {
|
||||
private ScriptEngine engine;
|
||||
private Script script;
|
||||
|
||||
@@ -1036,7 +1036,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ScriptDirectoryRunner : BaseController {
|
||||
private sealed class ScriptDirectoryRunner : BaseController {
|
||||
public string directory_path {
|
||||
get;
|
||||
construct;
|
||||
@@ -1226,7 +1226,7 @@ namespace Frida.Gadget {
|
||||
private ScriptConfig load_config (string path) throws Error {
|
||||
string data;
|
||||
try {
|
||||
FileUtils.get_contents (path, out data);
|
||||
load_asset_text (path, out data);
|
||||
} catch (FileError e) {
|
||||
if (e is FileError.NOENT)
|
||||
return new ScriptConfig ();
|
||||
@@ -1241,7 +1241,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class Script : Object, RpcPeer {
|
||||
private sealed class Script : Object, RpcPeer {
|
||||
private const uint8 QUICKJS_BYTECODE_MAGIC = 0x02;
|
||||
|
||||
public enum ChangeBehavior {
|
||||
@@ -1349,9 +1349,9 @@ namespace Frida.Gadget {
|
||||
try {
|
||||
var path = this.path;
|
||||
|
||||
uint8[] contents;
|
||||
Bytes contents;
|
||||
try {
|
||||
FileUtils.get_data (path, out contents);
|
||||
load_asset_bytes (path, out contents);
|
||||
} catch (FileError e) {
|
||||
throw new Error.INVALID_ARGUMENT ("%s", e.message);
|
||||
}
|
||||
@@ -1360,11 +1360,10 @@ namespace Frida.Gadget {
|
||||
options.name = Path.get_basename (path).split (".", 2)[0];
|
||||
|
||||
ScriptEngine.ScriptInstance instance;
|
||||
if (contents.length > 0 && contents[0] == QUICKJS_BYTECODE_MAGIC) {
|
||||
instance = yield engine.create_script (null, new Bytes (contents), options);
|
||||
} else {
|
||||
instance = yield engine.create_script ((string) contents, null, options);
|
||||
}
|
||||
if (contents.length > 0 && contents[0] == QUICKJS_BYTECODE_MAGIC)
|
||||
instance = yield engine.create_script (null, contents, options);
|
||||
else
|
||||
instance = yield engine.create_script ((string) contents.get_data (), null, options);
|
||||
|
||||
if (id.handle != 0)
|
||||
yield engine.destroy_script (id);
|
||||
@@ -1381,7 +1380,7 @@ namespace Frida.Gadget {
|
||||
var stage = new Json.Node.alloc ().init_string ((peek_state () == State.CREATED) ? "early" : "late");
|
||||
|
||||
try {
|
||||
yield rpc_client.call ("init", new Json.Node[] { stage, parameters }, null);
|
||||
yield rpc_client.call ("init", new Json.Node[] { stage, parameters }, null, null);
|
||||
} catch (GLib.Error e) {
|
||||
}
|
||||
}
|
||||
@@ -1449,12 +1448,12 @@ namespace Frida.Gadget {
|
||||
return true;
|
||||
}
|
||||
|
||||
private async void post_rpc_message (string json, Cancellable? cancellable) throws Error, IOError {
|
||||
engine.post_to_script (id, json);
|
||||
private async void post_rpc_message (string json, Bytes? data, Cancellable? cancellable) throws Error, IOError {
|
||||
engine.post_to_script (id, json, data);
|
||||
}
|
||||
}
|
||||
|
||||
private class ControlServer : BaseController {
|
||||
private sealed class ControlServer : BaseController {
|
||||
public EndpointParameters endpoint_params {
|
||||
get;
|
||||
construct;
|
||||
@@ -1497,7 +1496,8 @@ namespace Frida.Gadget {
|
||||
var endpoint_params = new EndpointParameters (interaction.address, interaction.port,
|
||||
parse_certificate (interaction.certificate, location), interaction.origin, auth_service, asset_root);
|
||||
|
||||
service = new WebService (endpoint_params, CONTROL, interaction.on_port_conflict);
|
||||
service = new WebService (endpoint_params, WebServiceFlavor.CONTROL, interaction.on_port_conflict,
|
||||
new TunnelInterfaceObserver ());
|
||||
service.incoming.connect (on_incoming_connection);
|
||||
yield service.start (io_cancellable);
|
||||
}
|
||||
@@ -1927,6 +1927,14 @@ namespace Frida.Gadget {
|
||||
throw new Error.NOT_SUPPORTED ("Unable to inject libraries when embedded");
|
||||
}
|
||||
|
||||
public async ChannelId open_channel (string address, Cancellable? cancellable) throws Error, IOError {
|
||||
throw new Error.NOT_SUPPORTED ("Unable to open channels when embedded");
|
||||
}
|
||||
|
||||
public async ServiceSessionId open_service (string address, Cancellable? cancellable) throws Error, IOError {
|
||||
throw new Error.NOT_SUPPORTED ("Unable to open services when embedded");
|
||||
}
|
||||
|
||||
private void validate_pid (uint pid) throws Error {
|
||||
if (pid != this_process.pid)
|
||||
throw new Error.NOT_SUPPORTED ("Unable to act on other processes when embedded");
|
||||
@@ -1958,7 +1966,7 @@ namespace Frida.Gadget {
|
||||
}
|
||||
}
|
||||
|
||||
private class ClusterClient : BaseController {
|
||||
private sealed class ClusterClient : BaseController {
|
||||
public SocketConnectable connectable {
|
||||
get;
|
||||
construct;
|
||||
@@ -2075,6 +2083,60 @@ namespace Frida.Gadget {
|
||||
}
|
||||
#endif
|
||||
|
||||
private void load_asset_text (string filename, out string text) throws FileError {
|
||||
Bytes raw_contents;
|
||||
load_asset_bytes (filename, out raw_contents);
|
||||
|
||||
unowned string str = (string) raw_contents.get_data ();
|
||||
if (!str.validate ())
|
||||
throw new FileError.FAILED ("%s: invalid UTF-8", filename);
|
||||
|
||||
text = str;
|
||||
}
|
||||
|
||||
private void load_asset_bytes (string filename, out Bytes bytes) throws FileError {
|
||||
#if ANDROID
|
||||
if (maybe_load_asset_bytes_from_apk (filename, out bytes))
|
||||
return;
|
||||
#endif
|
||||
|
||||
uint8[] data;
|
||||
FileUtils.get_data (filename, out data);
|
||||
bytes = new Bytes.take ((owned) data);
|
||||
}
|
||||
|
||||
#if ANDROID
|
||||
private bool maybe_load_asset_bytes_from_apk (string filename, out Bytes contents) throws FileError {
|
||||
contents = null;
|
||||
|
||||
var tokens = filename.split ("!", 2);
|
||||
if (tokens.length != 2 || !tokens[0].has_suffix (".apk"))
|
||||
return false;
|
||||
unowned string apk_path = tokens[0];
|
||||
unowned string file_path = tokens[1];
|
||||
|
||||
var reader = Minizip.Reader.create ();
|
||||
try {
|
||||
if (reader.open_file (apk_path) != OK)
|
||||
throw new FileError.FAILED ("Unable to open APK");
|
||||
|
||||
if (reader.locate_entry (file_path[1:], true) != OK)
|
||||
throw new FileError.FAILED ("Unable to locate %s inside APK", file_path);
|
||||
|
||||
var size = reader.entry_save_buffer_length ();
|
||||
var data = new uint8[size + 1];
|
||||
if (reader.entry_save_buffer (data[:size]) != OK)
|
||||
throw new FileError.FAILED ("Unable to extract %s from APK", file_path);
|
||||
|
||||
contents = new Bytes.take ((owned) data);
|
||||
return true;
|
||||
} finally {
|
||||
reader.close ();
|
||||
Minizip.Reader.destroy (ref reader);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private Json.Node make_empty_json_object () {
|
||||
return new Json.Node.alloc ().init_object (new Json.Object ());
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ if host_os_family == 'darwin'
|
||||
extra_link_args += '-Wl,-framework,Foundation'
|
||||
endif
|
||||
|
||||
if host_os == 'android'
|
||||
extra_vala_args += '--pkg=minizip'
|
||||
platform_deps += minizip_dep
|
||||
endif
|
||||
|
||||
if host_os_family == 'windows'
|
||||
if host_toolchain != 'microsoft'
|
||||
symfile = 'frida-gadget.symbols'
|
||||
@@ -60,7 +65,7 @@ raw_gadget = shared_library('frida-gadget-raw', gadget_sources,
|
||||
link_depends: extra_link_depends,
|
||||
vs_module_defs: 'frida-gadget.def',
|
||||
override_options: ['b_asneeded=true'],
|
||||
dependencies: [gio_dep, gee_dep, json_glib_dep, gum_dep, gumjs_dep, base_dep, tls_provider_dep, payload_dep] + platform_deps,
|
||||
dependencies: [gio_dep, gee_dep, json_glib_dep, gum_dep, gumjs_dep, base_dep, netif_dep, tls_provider_dep, payload_dep] + platform_deps,
|
||||
)
|
||||
|
||||
operations = [
|
||||
|
||||
@@ -2,6 +2,7 @@ if host_os == 'android'
|
||||
subdir('selinux')
|
||||
endif
|
||||
subdir('base')
|
||||
subdir('netif')
|
||||
subdir('pipe')
|
||||
subdir('payload')
|
||||
if have_local_backend
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
netif_sources = [
|
||||
'tunnel-interface-observer.vala',
|
||||
]
|
||||
|
||||
extra_vala_args = []
|
||||
extra_link_args = []
|
||||
|
||||
if host_os in ['ios', 'tvos']
|
||||
extra_vala_args += [
|
||||
'--pkg=corefoundation',
|
||||
'--pkg=darwin-gcd',
|
||||
'--pkg=darwin-systemconfiguration',
|
||||
]
|
||||
extra_link_args += '-Wl,-framework,SystemConfiguration'
|
||||
endif
|
||||
|
||||
netif = static_library('frida-netif', netif_sources,
|
||||
c_args: frida_component_cflags,
|
||||
vala_args: [base_vala_args, extra_vala_args],
|
||||
dependencies: [base_dep, gee_dep],
|
||||
)
|
||||
|
||||
netif_dep = declare_dependency(
|
||||
include_directories: include_directories('.'),
|
||||
link_args: extra_link_args,
|
||||
link_with: netif,
|
||||
dependencies: base_dep,
|
||||
)
|
||||
@@ -0,0 +1,99 @@
|
||||
public sealed class Frida.TunnelInterfaceObserver : Object, DynamicInterfaceObserver {
|
||||
#if IOS || TVOS
|
||||
private Gee.Map<string, DynamicInterface> interfaces = new Gee.HashMap<string, DynamicInterface> ();
|
||||
|
||||
private Darwin.SystemConfiguration.DynamicStore? store;
|
||||
private Darwin.GCD.DispatchQueue event_queue =
|
||||
new Darwin.GCD.DispatchQueue ("re.frida.endpoint-enumerator", Darwin.GCD.DispatchQueueAttr.SERIAL);
|
||||
|
||||
private MainContext? main_context;
|
||||
|
||||
public override void dispose () {
|
||||
if (store != null) {
|
||||
store.set_dispatch_queue (null);
|
||||
store = null;
|
||||
ref ();
|
||||
event_queue.dispatch_async (do_dispose);
|
||||
}
|
||||
|
||||
base.dispose ();
|
||||
}
|
||||
|
||||
private void do_dispose () {
|
||||
unref ();
|
||||
}
|
||||
|
||||
public void start () {
|
||||
main_context = MainContext.ref_thread_default ();
|
||||
|
||||
Darwin.SystemConfiguration.DynamicStoreContext context = { 0, };
|
||||
context.info = this;
|
||||
store = new Darwin.SystemConfiguration.DynamicStore (null, CoreFoundation.String.make ("Frida"),
|
||||
on_interfaces_changed_wrapper, context);
|
||||
|
||||
var pattern = CoreFoundation.String.make ("State:/Network/Interface/utun.*/IPv6");
|
||||
var patterns = new CoreFoundation.Array (null, ((CoreFoundation.Type[]) &pattern)[:1]);
|
||||
store.set_notification_keys (null, patterns);
|
||||
|
||||
store.set_dispatch_queue (event_queue);
|
||||
|
||||
var initial_keys = store.copy_key_list (pattern);
|
||||
if (initial_keys != null)
|
||||
handle_interface_changes (initial_keys);
|
||||
}
|
||||
|
||||
private static void on_interfaces_changed_wrapper (Darwin.SystemConfiguration.DynamicStore store,
|
||||
CoreFoundation.Array changed_keys, void * info) {
|
||||
unowned TunnelInterfaceObserver enumerator = (TunnelInterfaceObserver) info;
|
||||
enumerator.on_interfaces_changed (changed_keys);
|
||||
}
|
||||
|
||||
private void on_interfaces_changed (CoreFoundation.Array changed_keys) {
|
||||
schedule_on_frida_thread (() => {
|
||||
if (store != null)
|
||||
handle_interface_changes (changed_keys);
|
||||
return Source.REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
private void handle_interface_changes (CoreFoundation.Array changed_keys) {
|
||||
var addresses_str = CoreFoundation.String.make ("Addresses");
|
||||
|
||||
foreach (var key in CFArray.wrap<CoreFoundation.String> (changed_keys)) {
|
||||
string name = key.to_string ().split ("/")[3];
|
||||
|
||||
var val = (CoreFoundation.Dictionary) store.copy_value (key);
|
||||
if (val != null) {
|
||||
InetAddress? address = null;
|
||||
foreach (var raw_address in CFArray.wrap<CoreFoundation.String> (val[addresses_str])) {
|
||||
var str = raw_address.to_string ();
|
||||
bool is_reserved_ipv6_range = str.has_prefix ("fc") || str.has_prefix ("fd");
|
||||
bool is_tunnel = is_reserved_ipv6_range && str.has_suffix ("::1");
|
||||
if (is_tunnel) {
|
||||
address = new InetAddress.from_string (str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (address != null && !interfaces.has_key (name)) {
|
||||
var iface = new DynamicInterface (name, address);
|
||||
interfaces[name] = iface;
|
||||
interface_attached (iface);
|
||||
}
|
||||
} else {
|
||||
DynamicInterface iface;
|
||||
if (interfaces.unset (name, out iface))
|
||||
interface_detached (iface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void schedule_on_frida_thread (owned SourceFunc function) {
|
||||
var source = new IdleSource ();
|
||||
source.set_callback ((owned) function);
|
||||
source.attach (main_context);
|
||||
}
|
||||
#else
|
||||
public void start () {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+27
-24
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class ThreadIgnoreScope {
|
||||
public sealed class ThreadIgnoreScope {
|
||||
public enum Kind {
|
||||
APPLICATION_THREAD,
|
||||
FRIDA_THREAD
|
||||
@@ -43,7 +43,7 @@ namespace Frida {
|
||||
}
|
||||
|
||||
#if ANDROID
|
||||
public class ThreadCountCloaker : Object {
|
||||
public sealed class ThreadCountCloaker : Object {
|
||||
private ReadFunc * read_slot;
|
||||
private static ReadFunc old_read_impl;
|
||||
|
||||
@@ -53,15 +53,18 @@ namespace Frida {
|
||||
private delegate ssize_t ReadFunc (int fd, void * buf, size_t count);
|
||||
|
||||
construct {
|
||||
Gum.Module.enumerate_imports ("libart.so", imp => {
|
||||
if (imp.name == "read") {
|
||||
read_slot = (ReadFunc *) imp.slot;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (read_slot != null)
|
||||
old_read_impl = update_read_slot (on_read);
|
||||
var art = Gum.Process.find_module_by_name ("libart.so");
|
||||
if (art != null) {
|
||||
art.enumerate_imports (imp => {
|
||||
if (imp.name == "read") {
|
||||
read_slot = (ReadFunc *) imp.slot;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (read_slot != null)
|
||||
old_read_impl = update_read_slot (on_read);
|
||||
}
|
||||
}
|
||||
|
||||
~ThreadCountCloaker () {
|
||||
@@ -153,12 +156,12 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class ThreadCountCloaker : Object {
|
||||
public sealed class ThreadCountCloaker : Object {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX
|
||||
public class ThreadListCloaker : Object, DirListFilter {
|
||||
public sealed class ThreadListCloaker : Object, DirListFilter {
|
||||
private string our_dir_by_pid;
|
||||
private DirListCloaker cloaker;
|
||||
|
||||
@@ -177,7 +180,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class FDListCloaker : Object, DirListFilter {
|
||||
public sealed class FDListCloaker : Object, DirListFilter {
|
||||
private string our_dir_by_pid;
|
||||
private DirListCloaker cloaker;
|
||||
|
||||
@@ -196,7 +199,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class DirListCloaker : Object {
|
||||
private sealed class DirListCloaker : Object {
|
||||
public weak DirListFilter filter {
|
||||
get;
|
||||
construct;
|
||||
@@ -212,34 +215,34 @@ namespace Frida {
|
||||
construct {
|
||||
var interceptor = Gum.Interceptor.obtain ();
|
||||
|
||||
unowned string libc = Gum.Process.query_libc_name ();
|
||||
var libc = Gum.Process.get_libc_module ();
|
||||
|
||||
var open_listener = new OpenDirListener (this);
|
||||
listeners.add (open_listener);
|
||||
interceptor.attach ((void *) Gum.Module.find_export_by_name (libc, "opendir"), open_listener);
|
||||
interceptor.attach ((void *) libc.find_export_by_name ("opendir"), open_listener);
|
||||
|
||||
var close_listener = new CloseDirListener (this);
|
||||
listeners.add (close_listener);
|
||||
interceptor.attach ((void *) Gum.Module.find_export_by_name (libc, "closedir"), close_listener);
|
||||
interceptor.attach ((void *) libc.find_export_by_name ("closedir"), close_listener);
|
||||
|
||||
var readdir_impl = Gum.Module.find_export_by_name (libc, "readdir");
|
||||
var readdir_impl = libc.find_export_by_name ("readdir");
|
||||
var readdir_listener = new ReadDirListener (this, LEGACY);
|
||||
listeners.add (readdir_listener);
|
||||
interceptor.attach ((void *) readdir_impl, readdir_listener);
|
||||
|
||||
var readdir64_impl = Gum.Module.find_export_by_name (libc, "readdir64");
|
||||
var readdir64_impl = libc.find_export_by_name ("readdir64");
|
||||
if (readdir64_impl != 0 && readdir64_impl != readdir_impl) {
|
||||
var listener = new ReadDirListener (this, MODERN);
|
||||
listeners.add (listener);
|
||||
interceptor.attach ((void *) readdir64_impl, listener);
|
||||
}
|
||||
|
||||
var readdir_r_impl = Gum.Module.find_export_by_name (libc, "readdir_r");
|
||||
var readdir_r_impl = libc.find_export_by_name ("readdir_r");
|
||||
var readdir_r_listener = new ReadDirRListener (this, LEGACY);
|
||||
listeners.add (readdir_r_listener);
|
||||
interceptor.attach ((void *) readdir_r_impl, readdir_r_listener);
|
||||
|
||||
var readdir64_r_impl = Gum.Module.find_export_by_name (libc, "readdir64_r");
|
||||
var readdir64_r_impl = libc.find_export_by_name ("readdir64_r");
|
||||
if (readdir64_r_impl != 0 && readdir64_r_impl != readdir_r_impl) {
|
||||
var listener = new ReadDirRListener (this, MODERN);
|
||||
listeners.add (listener);
|
||||
@@ -464,10 +467,10 @@ namespace Frida {
|
||||
public abstract bool matches_file (string name);
|
||||
}
|
||||
#else
|
||||
public class ThreadListCloaker : Object {
|
||||
public sealed class ThreadListCloaker : Object {
|
||||
}
|
||||
|
||||
public class FDListCloaker : Object {
|
||||
public sealed class FDListCloaker : Object {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class ExitMonitor : Object, Gum.InvocationListener {
|
||||
public sealed class ExitMonitor : Object, Gum.InvocationListener {
|
||||
public weak ExitHandler handler {
|
||||
get;
|
||||
construct;
|
||||
@@ -32,16 +32,17 @@ namespace Frida {
|
||||
unowned Gum.InvocationListener listener = this;
|
||||
|
||||
#if WINDOWS
|
||||
interceptor.attach ((void *) Gum.Module.find_export_by_name ("kernel32.dll", "ExitProcess"), listener);
|
||||
interceptor.attach ((void *) Gum.Process.find_module_by_name ("kernel32.dll").find_export_by_name ("ExitProcess"),
|
||||
listener);
|
||||
#else
|
||||
unowned string libc = Gum.Process.query_libc_name ();
|
||||
var libc = Gum.Process.get_libc_module ();
|
||||
const string[] apis = {
|
||||
"exit",
|
||||
"_exit",
|
||||
"abort",
|
||||
};
|
||||
foreach (var symbol in apis) {
|
||||
interceptor.attach ((void *) Gum.Module.find_export_by_name (libc, symbol), listener);
|
||||
interceptor.attach ((void *) libc.find_export_by_name (symbol), listener);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Frida {
|
||||
#if WINDOWS
|
||||
public class FileDescriptorGuard : Object {
|
||||
public sealed class FileDescriptorGuard : Object {
|
||||
public Gum.MemoryRange agent_range {
|
||||
get;
|
||||
construct;
|
||||
@@ -11,7 +11,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class FileDescriptorGuard : Object {
|
||||
public sealed class FileDescriptorGuard : Object {
|
||||
public Gum.MemoryRange agent_range {
|
||||
get;
|
||||
construct;
|
||||
@@ -26,7 +26,7 @@ namespace Frida {
|
||||
construct {
|
||||
var interceptor = Gum.Interceptor.obtain ();
|
||||
|
||||
var close = Gum.Module.find_export_by_name (Gum.Process.query_libc_name (), "close");
|
||||
var close = Gum.Process.get_libc_module ().find_export_by_name ("close");
|
||||
close_listener = new CloseListener (this);
|
||||
interceptor.attach ((void *) close, close_listener);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Frida {
|
||||
#if WINDOWS
|
||||
public class FileDescriptorTablePadder {
|
||||
public sealed class FileDescriptorTablePadder {
|
||||
public static FileDescriptorTablePadder obtain () {
|
||||
return new FileDescriptorTablePadder ();
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class FileDescriptorTablePadder {
|
||||
public sealed class FileDescriptorTablePadder {
|
||||
private const int MIN_TABLE_SIZE = 32;
|
||||
|
||||
private static unowned FileDescriptorTablePadder shared_instance = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Frida {
|
||||
#if WINDOWS
|
||||
public class ForkMonitor : Object {
|
||||
public sealed class ForkMonitor : Object {
|
||||
public weak ForkHandler handler {
|
||||
get;
|
||||
construct;
|
||||
@@ -11,7 +11,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class ForkMonitor : Object, Gum.InvocationListener {
|
||||
public sealed class ForkMonitor : Object, Gum.InvocationListener {
|
||||
public weak ForkHandler handler {
|
||||
get;
|
||||
construct;
|
||||
@@ -45,9 +45,9 @@ namespace Frida {
|
||||
}
|
||||
|
||||
static construct {
|
||||
unowned string libc = Gum.Process.query_libc_name ();
|
||||
fork_impl = (void *) Gum.Module.find_export_by_name (libc, "fork");
|
||||
vfork_impl = (void *) Gum.Module.find_export_by_name (libc, "vfork");
|
||||
var libc = Gum.Process.get_libc_module ();
|
||||
fork_impl = (void *) libc.find_export_by_name ("fork");
|
||||
vfork_impl = (void *) libc.find_export_by_name ("vfork");
|
||||
}
|
||||
|
||||
construct {
|
||||
@@ -61,15 +61,21 @@ namespace Frida {
|
||||
string cmdline;
|
||||
FileUtils.get_contents ("/proc/self/cmdline", out cmdline);
|
||||
if (cmdline == "zygote" || cmdline == "zygote64" || cmdline == "usap32" || cmdline == "usap64") {
|
||||
var set_argv0 = (void *) Gum.Module.find_export_by_name ("libandroid_runtime.so", "_Z27android_os_Process_setArgV0P7_JNIEnvP8_jobjectP8_jstring");
|
||||
if (set_argv0 != null) {
|
||||
interceptor.attach (set_argv0, listener, (void *) HookId.SET_ARGV0);
|
||||
child_recovery_behavior = DEFERRED_UNTIL_SET_ARGV0;
|
||||
var runtime = Gum.Process.find_module_by_name ("libandroid_runtime.so");
|
||||
if (runtime != null) {
|
||||
var set_argv0 = (void *) runtime.find_export_by_name ("_Z27android_os_Process_setArgV0P7_JNIEnvP8_jobjectP8_jstring");
|
||||
if (set_argv0 != null) {
|
||||
interceptor.attach (set_argv0, listener, (void *) HookId.SET_ARGV0);
|
||||
child_recovery_behavior = DEFERRED_UNTIL_SET_ARGV0;
|
||||
}
|
||||
}
|
||||
|
||||
var setcontext = (void *) Gum.Module.find_export_by_name ("libselinux.so", "selinux_android_setcontext");
|
||||
if (setcontext != null)
|
||||
interceptor.attach (setcontext, listener, (void *) HookId.SET_CTX);
|
||||
var selinux = Gum.Process.find_module_by_name ("libselinux.so");
|
||||
if (selinux != null) {
|
||||
var setcontext = (void *) selinux.find_export_by_name ("selinux_android_setcontext");
|
||||
if (setcontext != null)
|
||||
interceptor.attach (setcontext, listener, (void *) HookId.SET_CTX);
|
||||
}
|
||||
}
|
||||
} catch (FileError e) {
|
||||
}
|
||||
|
||||
@@ -25,6 +25,24 @@ frida_run_atexit_handlers (void)
|
||||
{
|
||||
}
|
||||
|
||||
# ifdef HAVE_ASAN
|
||||
|
||||
__attribute__ ((constructor)) static void
|
||||
frida_init_memory (void)
|
||||
{
|
||||
asm volatile ("");
|
||||
}
|
||||
|
||||
# ifndef HAVE_DARWIN
|
||||
__attribute__ ((destructor)) static void
|
||||
frida_deinit_memory (void)
|
||||
{
|
||||
asm volatile ("");
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
#define FRIDA_SHIM_LOCK() gum_spinlock_acquire (&frida_shim_lock)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class PortalClient : Object, AgentSessionProvider {
|
||||
public sealed class PortalClient : Object, AgentSessionProvider {
|
||||
public signal void resume ();
|
||||
public signal void kill ();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class ScriptEngine : Object {
|
||||
public sealed class ScriptEngine : Object {
|
||||
public signal void message_from_script (AgentScriptId script_id, string json, Bytes? data);
|
||||
public signal void message_from_debugger (AgentScriptId script_id, string message);
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace Frida {
|
||||
source.attach (Gum.ScriptBackend.get_scheduler ().get_js_context ());
|
||||
}
|
||||
|
||||
public class ScriptInstance : Object, RpcPeer {
|
||||
public sealed class ScriptInstance : Object, RpcPeer {
|
||||
public signal void closed ();
|
||||
public signal void message (string json, Bytes? data);
|
||||
public signal void debug_message (string message);
|
||||
@@ -420,7 +420,7 @@ namespace Frida {
|
||||
var reason_value = new Json.Node.alloc ().init_string (reason.to_nick ());
|
||||
|
||||
try {
|
||||
yield rpc_client.call ("dispose", new Json.Node[] { reason_value }, null);
|
||||
yield rpc_client.call ("dispose", new Json.Node[] { reason_value }, null, null);
|
||||
} catch (GLib.Error e) {
|
||||
}
|
||||
|
||||
@@ -467,10 +467,10 @@ namespace Frida {
|
||||
this.debug_message (message);
|
||||
}
|
||||
|
||||
private async void post_rpc_message (string json, Cancellable? cancellable) throws Error, IOError {
|
||||
private async void post_rpc_message (string json, Bytes? data, Cancellable? cancellable) throws Error, IOError {
|
||||
if (script == null)
|
||||
throw new Error.INVALID_OPERATION ("Script is destroyed");
|
||||
script.post (json);
|
||||
script.post (json, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class SpawnMonitor : Object, Gum.InvocationListener {
|
||||
public sealed class SpawnMonitor : Object, Gum.InvocationListener {
|
||||
public weak SpawnHandler handler {
|
||||
get;
|
||||
construct;
|
||||
@@ -38,21 +38,24 @@ namespace Frida {
|
||||
var interceptor = Gum.Interceptor.obtain ();
|
||||
|
||||
#if WINDOWS
|
||||
var create_process_internal = Gum.Module.find_export_by_name ("kernelbase.dll", "CreateProcessInternalW");
|
||||
if (create_process_internal == 0)
|
||||
create_process_internal = Gum.Module.find_export_by_name ("kernel32.dll", "CreateProcessInternalW");
|
||||
var kernelbase = Gum.Process.find_module_by_name ("kernelbase.dll");
|
||||
var create_process_internal = (kernelbase != null) ? kernelbase.find_export_by_name ("CreateProcessInternalW") : 0;
|
||||
if (create_process_internal == 0) {
|
||||
create_process_internal = Gum.Process.find_module_by_name ("kernel32.dll")
|
||||
.find_export_by_name ("CreateProcessInternalW");
|
||||
}
|
||||
assert (create_process_internal != 0);
|
||||
interceptor.attach ((void *) create_process_internal, this);
|
||||
#else
|
||||
unowned string libc = Gum.Process.query_libc_name ();
|
||||
var libc = Gum.Process.get_libc_module ();
|
||||
#if DARWIN
|
||||
posix_spawn = (PosixSpawnFunc) Gum.Module.find_export_by_name (libc, "posix_spawn");
|
||||
posix_spawnattr_init = (PosixSpawnAttrInitFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_init");
|
||||
posix_spawnattr_destroy = (PosixSpawnAttrDestroyFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_destroy");
|
||||
posix_spawnattr_getflags = (PosixSpawnAttrSetFlagsFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_getflags");
|
||||
posix_spawnattr_setflags = (PosixSpawnAttrSetFlagsFunc) Gum.Module.find_export_by_name (libc, "posix_spawnattr_setflags");
|
||||
posix_spawn = (PosixSpawnFunc) libc.find_export_by_name ("posix_spawn");
|
||||
posix_spawnattr_init = (PosixSpawnAttrInitFunc) libc.find_export_by_name ("posix_spawnattr_init");
|
||||
posix_spawnattr_destroy = (PosixSpawnAttrDestroyFunc) libc.find_export_by_name ("posix_spawnattr_destroy");
|
||||
posix_spawnattr_getflags = (PosixSpawnAttrSetFlagsFunc) libc.find_export_by_name ("posix_spawnattr_getflags");
|
||||
posix_spawnattr_setflags = (PosixSpawnAttrSetFlagsFunc) libc.find_export_by_name ("posix_spawnattr_setflags");
|
||||
|
||||
execve = (void *) Gum.Module.find_export_by_name (libc, "execve");
|
||||
execve = (void *) libc.find_export_by_name ("execve");
|
||||
|
||||
interceptor.attach ((void *) posix_spawn, this);
|
||||
|
||||
@@ -60,10 +63,10 @@ namespace Frida {
|
||||
#else
|
||||
Gum.Address execve = 0;
|
||||
#if ANDROID
|
||||
execve = Gum.Module.find_symbol_by_name (libc, "__execve");
|
||||
execve = libc.find_symbol_by_name ("__execve");
|
||||
#endif
|
||||
if (execve == 0)
|
||||
execve = Gum.Module.find_export_by_name (libc, "execve");
|
||||
execve = libc.find_export_by_name ("execve");
|
||||
interceptor.attach ((void *) execve, this);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Frida {
|
||||
#if DARWIN
|
||||
public class ThreadSuspendMonitor : Object {
|
||||
public sealed class ThreadSuspendMonitor : Object {
|
||||
public weak ProcessInvader invader {
|
||||
get;
|
||||
construct;
|
||||
@@ -26,9 +26,10 @@ namespace Frida {
|
||||
construct {
|
||||
var interceptor = Gum.Interceptor.obtain ();
|
||||
|
||||
task_threads = (TaskThreadsFunc) Gum.Module.find_export_by_name (LIBSYSTEM_KERNEL, "task_threads");
|
||||
thread_suspend = (ThreadSuspendFunc) Gum.Module.find_export_by_name (LIBSYSTEM_KERNEL, "thread_suspend");
|
||||
thread_resume = (ThreadResumeFunc) Gum.Module.find_export_by_name (LIBSYSTEM_KERNEL, "thread_resume");
|
||||
var kernel = Gum.Process.find_module_by_name (LIBSYSTEM_KERNEL);
|
||||
task_threads = (TaskThreadsFunc) kernel.find_export_by_name ("task_threads");
|
||||
thread_suspend = (ThreadSuspendFunc) kernel.find_export_by_name ("thread_suspend");
|
||||
thread_resume = (ThreadResumeFunc) kernel.find_export_by_name ("thread_resume");
|
||||
|
||||
interceptor.replace ((void *) task_threads, (void *) replacement_task_threads, this);
|
||||
interceptor.replace ((void *) thread_suspend, (void *) replacement_thread_suspend, this);
|
||||
@@ -130,7 +131,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class ThreadSuspendMonitor : Object {
|
||||
public sealed class ThreadSuspendMonitor : Object {
|
||||
public weak ProcessInvader invader {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -300,6 +300,7 @@ static gpointer
|
||||
frida_find_vtable (void)
|
||||
{
|
||||
GumAddress result = 0;
|
||||
GumModule * libunwind;
|
||||
GumAddress export;
|
||||
uint64_t address;
|
||||
G_GNUC_UNUSED cs_err err;
|
||||
@@ -309,11 +310,15 @@ frida_find_vtable (void)
|
||||
size_t size;
|
||||
const size_t max_size = 2048;
|
||||
|
||||
export = gum_module_find_export_by_name (FRIDA_LIBUNWIND_PATH, "unw_init_local");
|
||||
libunwind = gum_process_find_module_by_name (FRIDA_LIBUNWIND_PATH);
|
||||
if (libunwind == NULL)
|
||||
goto beach;
|
||||
|
||||
export = gum_module_find_export_by_name (libunwind, "unw_init_local");
|
||||
if (export == 0)
|
||||
export = gum_module_find_export_by_name (FRIDA_LIBUNWIND_PATH, "_Unwind_RaiseException");
|
||||
export = gum_module_find_export_by_name (libunwind, "_Unwind_RaiseException");
|
||||
if (export == 0)
|
||||
return NULL;
|
||||
goto beach;
|
||||
export = gum_strip_code_address (export);
|
||||
address = export;
|
||||
|
||||
@@ -340,7 +345,7 @@ frida_find_vtable (void)
|
||||
GumMemoryRange bss_range;
|
||||
|
||||
bss_range.base_address = 0;
|
||||
gum_module_enumerate_sections (FRIDA_LIBUNWIND_PATH, (GumFoundSectionFunc) frida_find_bss_range, &bss_range);
|
||||
gum_module_enumerate_sections (libunwind, (GumFoundSectionFunc) frida_find_bss_range, &bss_range);
|
||||
|
||||
while (cs_disasm_iter (capstone, &code, &size, &address, insn))
|
||||
{
|
||||
@@ -404,6 +409,9 @@ frida_find_vtable (void)
|
||||
cs_free (insn, 1);
|
||||
cs_close (&capstone);
|
||||
|
||||
beach:
|
||||
g_clear_object (&libunwind);
|
||||
|
||||
return GSIZE_TO_POINTER (result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Frida {
|
||||
#if DARWIN
|
||||
public class UnwindSitter : Object {
|
||||
public sealed class UnwindSitter : Object {
|
||||
public weak ProcessInvader invader {
|
||||
get;
|
||||
construct;
|
||||
@@ -21,7 +21,7 @@ namespace Frida {
|
||||
var interceptor = Gum.Interceptor.obtain ();
|
||||
|
||||
dyld_find_unwind_sections = (DyldFindUnwindSectionsFunc)
|
||||
Gum.Module.find_export_by_name (LIBDYLD, "_dyld_find_unwind_sections");
|
||||
Gum.Process.find_module_by_name (LIBDYLD).find_export_by_name ("_dyld_find_unwind_sections");
|
||||
|
||||
interceptor.replace ((void *) dyld_find_unwind_sections, (void *) replacement_dyld_find_unwind_sections, this);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Frida {
|
||||
public extern static void _unhook_libunwind ();
|
||||
}
|
||||
#else
|
||||
public class UnwindSitter : Object {
|
||||
public sealed class UnwindSitter : Object {
|
||||
public weak ProcessInvader invader {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "pipe-glue.h"
|
||||
|
||||
#include "frida-tvos.h"
|
||||
|
||||
#include "pipe-glue.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class PipeTransport : Object {
|
||||
public sealed class PipeTransport : Object {
|
||||
public string local_address {
|
||||
get;
|
||||
construct;
|
||||
@@ -42,7 +42,7 @@ namespace Frida {
|
||||
}
|
||||
|
||||
#if WINDOWS
|
||||
public class WindowsPipe : IOStream {
|
||||
public sealed class WindowsPipe : IOStream {
|
||||
public string address {
|
||||
get;
|
||||
construct;
|
||||
|
||||
+114
-14
@@ -92,6 +92,12 @@ else
|
||||
host_arch = host_machine.cpu_family()
|
||||
host_abi = host_arch
|
||||
endif
|
||||
if cc.sizeof('void *') == 8
|
||||
host_cpu_mode = '64'
|
||||
else
|
||||
host_cpu_mode = '32'
|
||||
endif
|
||||
host_docks_mobile_devices = host_os in ['windows', 'macos', 'linux'] and host_cpu_mode == '64'
|
||||
gumjs_archs = {
|
||||
'x86': 'ia32',
|
||||
'x86_64': 'x64',
|
||||
@@ -156,10 +162,12 @@ if host_os_family == 'darwin'
|
||||
endif
|
||||
endif
|
||||
|
||||
if cc.sizeof('void *') == 8
|
||||
host_cpu_mode = '64'
|
||||
else
|
||||
host_cpu_mode = '32'
|
||||
if host_machine.endian() == 'big'
|
||||
if host_abi in ['arm', 'armhf']
|
||||
host_abi = 'armbe8'
|
||||
elif host_abi == 'arm64'
|
||||
host_abi = 'arm64be'
|
||||
endif
|
||||
endif
|
||||
|
||||
if host_os_family == 'darwin' and host_arch == 'arm64'
|
||||
@@ -347,15 +355,35 @@ else
|
||||
gio_unix_dep = dependency('gio-unix-2.0')
|
||||
endif
|
||||
|
||||
if host_os == 'android'
|
||||
minizip_dep = dependency('minizip', required: false, default_options: [
|
||||
'zlib=enabled',
|
||||
'lzma=disabled',
|
||||
])
|
||||
endif
|
||||
|
||||
have_local_backend = get_option('local_backend').allowed()
|
||||
have_fruity_backend = get_option('fruity_backend').allowed()
|
||||
have_droidy_backend = get_option('droidy_backend').allowed()
|
||||
have_fruity_backend = get_option('fruity_backend') \
|
||||
.disable_auto_if(not host_docks_mobile_devices) \
|
||||
.allowed()
|
||||
have_droidy_backend = get_option('droidy_backend') \
|
||||
.disable_auto_if(not host_docks_mobile_devices) \
|
||||
.allowed()
|
||||
have_socket_backend = get_option('socket_backend').allowed()
|
||||
have_barebone_backend = quickjs_dep.found()
|
||||
have_barebone_backend = get_option('barebone_backend') \
|
||||
.disable_if(not quickjs_dep.found()) \
|
||||
.disable_auto_if(not host_docks_mobile_devices) \
|
||||
.allowed()
|
||||
have_compiler_backend = get_option('compiler_backend') \
|
||||
.disable_if(not have_local_backend, error_message: 'compiler backend requires the local backend for script execution') \
|
||||
.disable_auto_if(host_os == 'watchos') \
|
||||
.allowed()
|
||||
if get_option('compiler_snapshot').auto()
|
||||
# Generating our snapshot with V8's CPU simulator takes a very long time.
|
||||
generate_compiler_snapshot = meson.can_run_host_binaries()
|
||||
else
|
||||
generate_compiler_snapshot = get_option('compiler_snapshot').enabled()
|
||||
endif
|
||||
|
||||
build_gadget = get_option('gadget') \
|
||||
.disable_auto_if(meson.is_subproject()) \
|
||||
@@ -394,7 +422,7 @@ foreach b : [['local', have_local_backend],
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if have_barebone_backend or have_compiler_backend
|
||||
if host_os_family == 'darwin' or host_os == 'android' or have_barebone_backend or have_compiler_backend
|
||||
node = find_program('node', version: '>=18.0.0', native: true, required: false)
|
||||
if not node.found()
|
||||
error('Need Node.js >= 18.0.0 to process JavaScript code at build time')
|
||||
@@ -411,9 +439,8 @@ if gi_dep.found()
|
||||
else
|
||||
girdir = get_option('prefix') / get_option('datadir') / 'gir-1.0'
|
||||
endif
|
||||
uninstalled_girdir = meson.current_build_dir() / 'src'
|
||||
|
||||
vapidir = get_option('datadir') / 'vala' / 'vapi'
|
||||
vapidir = get_option('prefix') / get_option('datadir') / 'vala' / 'vapi'
|
||||
|
||||
gum_vala_args = [
|
||||
'--pkg=frida-gum-1.0',
|
||||
@@ -437,6 +464,43 @@ backend_deps_private = []
|
||||
backend_reqs_private = []
|
||||
backend_libs_private = []
|
||||
|
||||
openssl_options = [
|
||||
'cli=disabled',
|
||||
]
|
||||
if host_os_family == 'windows' and cc.get_argument_syntax() != 'msvc'
|
||||
openssl_options += 'asm=disabled'
|
||||
endif
|
||||
openssl_dep = dependency('openssl',
|
||||
required: have_fruity_backend or get_option('connectivity').enabled(),
|
||||
modules: cc.get_argument_syntax() == 'msvc' ? ['OpenSSL::SSL'] : [],
|
||||
default_options: openssl_options,
|
||||
)
|
||||
|
||||
if have_fruity_backend
|
||||
foreach dep : ['libnghttp2', 'libngtcp2', 'libngtcp2_crypto_quictls', 'libusb-1.0']
|
||||
backend_deps_private += dependency(dep)
|
||||
backend_reqs_private += dep
|
||||
endforeach
|
||||
|
||||
lwip_options = [
|
||||
'ipv4=disabled',
|
||||
'ipv6=enabled',
|
||||
'dns=disabled',
|
||||
'arp=disabled',
|
||||
'ethernet=enabled',
|
||||
'tcp_mss=4036',
|
||||
'tcp_snd_buf=65535',
|
||||
'tcp_wnd=65535',
|
||||
]
|
||||
if optimize_for_prod
|
||||
lwip_options += 'lwip_debug=disabled'
|
||||
else
|
||||
lwip_options += 'lwip_debug=enabled'
|
||||
endif
|
||||
backend_deps_private += dependency('lwip', default_options: lwip_options)
|
||||
backend_reqs_private += 'lwip'
|
||||
endif
|
||||
|
||||
if quickjs_dep.found()
|
||||
backend_deps_private += quickjs_dep
|
||||
backend_reqs_private += 'quickjs'
|
||||
@@ -456,8 +520,19 @@ else
|
||||
termux_elf_cleaner = []
|
||||
endif
|
||||
|
||||
tls_provider_dep = dependency('gioopenssl', required: get_option('connectivity'))
|
||||
tls_provider_dep = dependency('gioopenssl', required: get_option('connectivity'), default_options: [
|
||||
'gnutls=disabled',
|
||||
'openssl=enabled',
|
||||
'libproxy=disabled',
|
||||
'gnome_proxy=disabled',
|
||||
'tests=false',
|
||||
])
|
||||
tls_provider_vala_args = []
|
||||
if tls_provider_dep.found()
|
||||
tls_provider_vala_args += [
|
||||
'--pkg=gioopenssl',
|
||||
'--vapidir=' + tls_provider_dep.get_variable('vapidir'),
|
||||
]
|
||||
cdata.set('HAVE_GIOOPENSSL', 1)
|
||||
vala_flags += ['--define=HAVE_GIOOPENSSL']
|
||||
backend_deps_private += tls_provider_dep
|
||||
@@ -473,7 +548,6 @@ nice_dep = dependency('nice', required: get_option('connectivity'), default_opti
|
||||
'introspection=disabled',
|
||||
])
|
||||
if nice_dep.found()
|
||||
openssl_dep = dependency('openssl')
|
||||
usrsctp_dep = dependency('usrsctp', default_options: [
|
||||
'sctp_inet=false',
|
||||
'sctp_inet6=false',
|
||||
@@ -489,7 +563,6 @@ if nice_dep.found()
|
||||
cdata.set('HAVE_SCONN_LEN', 1)
|
||||
endif
|
||||
else
|
||||
openssl_dep = []
|
||||
usrsctp_dep = []
|
||||
endif
|
||||
|
||||
@@ -599,6 +672,8 @@ post_process = [
|
||||
'@INPUT0@',
|
||||
]
|
||||
|
||||
compile_js_agent = files('tools' / 'compile-js-agent.py')
|
||||
|
||||
mapper_opt = get_option('mapper')
|
||||
if mapper_opt.auto()
|
||||
have_mapper = host_os_family == 'darwin'
|
||||
@@ -627,8 +702,9 @@ if cc.get_id() == 'gcc' and cc.compiles('#if __GNUC__ >= 5\n#error NOTNEEDED\n#e
|
||||
add_project_arguments('-w', language: 'c')
|
||||
endif
|
||||
|
||||
vapidir = meson.current_source_dir() / 'vapi'
|
||||
vala_flags += [
|
||||
'--vapidir=' + meson.current_source_dir() / 'vapi',
|
||||
'--vapidir=' + vapidir,
|
||||
'--pkg', 'config',
|
||||
]
|
||||
|
||||
@@ -641,11 +717,13 @@ if host_abi != host_arch
|
||||
vala_flags += ['--define=' + host_abi.to_upper()]
|
||||
endif
|
||||
add_project_arguments(vala_flags, language: 'vala')
|
||||
add_project_arguments('-I' + vapidir, language: 'c')
|
||||
|
||||
native_vala_flags = [
|
||||
'--vapidir=' + meson.current_source_dir() / 'vapi',
|
||||
]
|
||||
add_project_arguments(native_vala_flags, language: 'vala', native: true)
|
||||
add_project_arguments('-I' + vapidir, language: 'c', native: true)
|
||||
|
||||
subdir('compat')
|
||||
subdir('tools')
|
||||
@@ -664,9 +742,31 @@ if build_tests
|
||||
subdir('tests')
|
||||
endif
|
||||
|
||||
summary(
|
||||
{
|
||||
'local': have_local_backend,
|
||||
'fruity': have_fruity_backend,
|
||||
'droidy': have_droidy_backend,
|
||||
'socket': have_socket_backend,
|
||||
'barebone': have_barebone_backend,
|
||||
'compiler': have_compiler_backend,
|
||||
},
|
||||
section: 'Backends',
|
||||
bool_yn: true,
|
||||
)
|
||||
summary(
|
||||
{
|
||||
'compat': compat_summary,
|
||||
'assets': get_option('assets'),
|
||||
'mapper': have_mapper,
|
||||
'connectivity': tls_provider_dep.found(),
|
||||
'compiler_snapshot': generate_compiler_snapshot,
|
||||
'gadget': build_gadget,
|
||||
'server': build_server,
|
||||
'portal': build_portal,
|
||||
'inject': build_inject,
|
||||
'tests': build_tests,
|
||||
},
|
||||
section: 'Features',
|
||||
bool_yn: true,
|
||||
)
|
||||
+15
-13
@@ -68,13 +68,25 @@ option('compat',
|
||||
option('helper_modern',
|
||||
type: 'string',
|
||||
value: 'auto',
|
||||
description: 'Prebuilt frida-helper to embed for use on modern systems'
|
||||
description: 'Prebuilt frida-helper to embed for supporting modern targets'
|
||||
)
|
||||
|
||||
option('helper_legacy',
|
||||
type: 'string',
|
||||
value: 'auto',
|
||||
description: 'Prebuilt frida-helper to embed for use on legacy systems'
|
||||
description: 'Prebuilt frida-helper to embed for supporting legacy targets'
|
||||
)
|
||||
|
||||
option('helper_emulated_modern',
|
||||
type: 'string',
|
||||
value: 'auto',
|
||||
description: 'Prebuilt frida-helper to embed for supporting modern emulated targets'
|
||||
)
|
||||
|
||||
option('helper_emulated_legacy',
|
||||
type: 'string',
|
||||
value: 'auto',
|
||||
description: 'Prebuilt frida-helper to embed for supporting legacy emulated targets'
|
||||
)
|
||||
|
||||
option('agent_modern',
|
||||
@@ -101,16 +113,6 @@ option('agent_emulated_legacy',
|
||||
description: 'Prebuilt agent to embed for use on legacy emulated targets'
|
||||
)
|
||||
|
||||
option('agent_dbghelp_prefix',
|
||||
type: 'string',
|
||||
description: 'Location of DbgHelp binaries to embed alongside agent (Windows only)'
|
||||
)
|
||||
|
||||
option('agent_symsrv_prefix',
|
||||
type: 'string',
|
||||
description: 'Location of SymSrv binaries to embed alongside agent (Windows only)'
|
||||
)
|
||||
|
||||
option('gadget',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
@@ -137,7 +139,7 @@ option('inject',
|
||||
|
||||
option('connectivity',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
value: 'enabled',
|
||||
description: 'Internet connectivity features (TLS and ICE support)'
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ if tls_provider_dep.found()
|
||||
endif
|
||||
|
||||
raw_portal = executable('frida-portal-raw', portal_sources,
|
||||
vala_args: [core_vala_args, '--pkg=posix'],
|
||||
vala_args: [core_vala_args, tls_provider_vala_args, '--pkg=posix'],
|
||||
link_args: extra_link_args,
|
||||
link_depends: extra_link_depends,
|
||||
dependencies: [core_dep] + extra_deps,
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ namespace Frida.Portal {
|
||||
return application.run ();
|
||||
}
|
||||
|
||||
private class Application : Object {
|
||||
private sealed class Application : Object {
|
||||
public signal void ready (bool success);
|
||||
|
||||
public PortalService service {
|
||||
|
||||
+1
-1
Submodule releng updated: 6bad5eec71...5d9edf166c.
+52
-9
@@ -3,6 +3,7 @@ namespace Frida.Server {
|
||||
|
||||
private const string DEFAULT_DIRECTORY = "re.frida.server";
|
||||
private static bool output_version = false;
|
||||
private static string? device_id = null;
|
||||
private static string? listen_address = null;
|
||||
private static string? certpath = null;
|
||||
private static string? origin = null;
|
||||
@@ -30,6 +31,7 @@ namespace Frida.Server {
|
||||
|
||||
const OptionEntry[] option_entries = {
|
||||
{ "version", 0, 0, OptionArg.NONE, ref output_version, "Output version information and exit", null },
|
||||
{ "device", 0, 0, OptionArg.STRING, ref device_id, "Serve device with the given ID", "ID" },
|
||||
{ "listen", 'l', 0, OptionArg.STRING, ref listen_address, "Listen on ADDRESS", "ADDRESS" },
|
||||
{ "certificate", 0, 0, OptionArg.FILENAME, ref certpath, "Enable TLS using CERTIFICATE", "CERTIFICATE" },
|
||||
{ "origin", 0, 0, OptionArg.STRING, ref origin, "Only accept requests with “Origin” header matching ORIGIN " +
|
||||
@@ -178,7 +180,7 @@ namespace Frida.Server {
|
||||
|
||||
#if DARWIN
|
||||
var worker = new Thread<int> ("frida-server-main-loop", () => {
|
||||
var exit_code = run_application (endpoint_params, options, on_ready);
|
||||
var exit_code = run_application (device_id, endpoint_params, options, on_ready);
|
||||
|
||||
_stop_run_loop ();
|
||||
|
||||
@@ -190,15 +192,16 @@ namespace Frida.Server {
|
||||
|
||||
return exit_code;
|
||||
#else
|
||||
return run_application (endpoint_params, options, on_ready);
|
||||
return run_application (device_id, endpoint_params, options, on_ready);
|
||||
#endif
|
||||
}
|
||||
|
||||
private static int run_application (EndpointParameters endpoint_params, ControlServiceOptions options, ReadyHandler on_ready) {
|
||||
private static int run_application (string? device_id, EndpointParameters endpoint_params, ControlServiceOptions options,
|
||||
ReadyHandler on_ready) {
|
||||
TemporaryDirectory.always_use ((directory != null) ? directory : DEFAULT_DIRECTORY);
|
||||
TemporaryDirectory.use_sysroot (options.sysroot);
|
||||
|
||||
application = new Application (new ControlService (endpoint_params, options));
|
||||
application = new Application (device_id, endpoint_params, options);
|
||||
|
||||
Posix.signal (Posix.Signal.INT, (sig) => {
|
||||
application.stop ();
|
||||
@@ -232,22 +235,39 @@ namespace Frida.Server {
|
||||
}
|
||||
#endif
|
||||
|
||||
private class Application : Object {
|
||||
private sealed class Application : Object {
|
||||
public signal void ready (bool success);
|
||||
|
||||
public ControlService service {
|
||||
public string? device_id {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
public EndpointParameters endpoint_params {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
public ControlServiceOptions options {
|
||||
get;
|
||||
construct;
|
||||
}
|
||||
|
||||
private DeviceManager? manager;
|
||||
private ControlService? service;
|
||||
|
||||
private Cancellable io_cancellable = new Cancellable ();
|
||||
|
||||
private MainLoop loop = new MainLoop ();
|
||||
private int exit_code;
|
||||
private bool stopping;
|
||||
|
||||
public Application (ControlService service) {
|
||||
Object (service: service);
|
||||
public Application (string? device_id, EndpointParameters endpoint_params, ControlServiceOptions options) {
|
||||
Object (
|
||||
device_id: device_id,
|
||||
endpoint_params: endpoint_params,
|
||||
options: options
|
||||
);
|
||||
}
|
||||
|
||||
public int run () {
|
||||
@@ -265,6 +285,17 @@ namespace Frida.Server {
|
||||
|
||||
private async void start () {
|
||||
try {
|
||||
if (device_id != null && device_id != "local") {
|
||||
manager = new DeviceManager.with_nonlocal_backends_only ();
|
||||
|
||||
var device = yield manager.get_device_by_id (device_id, 0, io_cancellable);
|
||||
device.lost.connect (on_device_lost);
|
||||
|
||||
service = yield new ControlService.with_device (device, endpoint_params, options);
|
||||
} else {
|
||||
service = new ControlService (endpoint_params, options);
|
||||
}
|
||||
|
||||
yield service.start (io_cancellable);
|
||||
} catch (GLib.Error e) {
|
||||
if (e is IOError.CANCELLED)
|
||||
@@ -297,7 +328,15 @@ namespace Frida.Server {
|
||||
io_cancellable.cancel ();
|
||||
|
||||
try {
|
||||
yield service.stop ();
|
||||
if (service != null) {
|
||||
yield service.stop ();
|
||||
service = null;
|
||||
}
|
||||
|
||||
if (manager != null) {
|
||||
yield manager.close ();
|
||||
manager = null;
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
}
|
||||
|
||||
@@ -306,6 +345,10 @@ namespace Frida.Server {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void on_device_lost () {
|
||||
stop ();
|
||||
}
|
||||
}
|
||||
|
||||
private TlsCertificate? parse_certificate (string? path) throws GLib.Error {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class AgentContainer : Object, AgentSessionProvider {
|
||||
public sealed class AgentContainer : Object, AgentSessionProvider {
|
||||
public DBusConnection connection {
|
||||
get;
|
||||
private set;
|
||||
|
||||
+91284
File diff suppressed because it is too large.
Load diff
+29500
File diff suppressed because it is too large.
Load diff
+141723
File diff suppressed because it is too large.
Load diff
+136
-36
@@ -1,36 +1,52 @@
|
||||
from __future__ import annotations
|
||||
import argparse
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
from typing import List, Set
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
CORE_NAMESPACE = "http://www.gtk.org/introspection/core/1.0"
|
||||
C_NAMESPACE = "http://www.gtk.org/introspection/c/1.0"
|
||||
GLIB_NAMESPACE = "http://www.gtk.org/introspection/glib/1.0"
|
||||
GIR_NAMESPACES = {
|
||||
"": CORE_NAMESPACE,
|
||||
"c": C_NAMESPACE,
|
||||
"glib": GLIB_NAMESPACE,
|
||||
}
|
||||
|
||||
CORE_TAG_IMPLEMENTS = f"{{{CORE_NAMESPACE}}}implements"
|
||||
CORE_TAG_FIELD = f"{{{CORE_NAMESPACE}}}field"
|
||||
CORE_TAG_CONSTRUCTOR = f"{{{CORE_NAMESPACE}}}constructor"
|
||||
CORE_TAG_METHOD = f"{{{CORE_NAMESPACE}}}method"
|
||||
|
||||
OBJECT_TYPE_PATTERN = re.compile(r"\bpublic\s+(sealed )?(class|interface)\s+(\w+)\b")
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Generate refined Frida API definitions")
|
||||
parser.add_argument('--output', dest='output_type', choices=['bundle', 'header', 'gir', 'vapi', 'vapi-stamp'], default='bundle')
|
||||
parser.add_argument('api_version', metavar='api-version', type=str)
|
||||
parser.add_argument('core_header', metavar='/path/to/frida-core.h', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('core_gir', metavar='/path/to/Frida-x.y.gir', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('core_vapi', metavar='/path/to/frida-core.vapi', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('core_header', metavar='/path/to/frida-core.h', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('base_vapi', metavar='/path/to/frida-base.vapi', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('base_header', metavar='/path/to/frida-base.h', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('base_gir', metavar='/path/to/FridaBase-x.y.gir', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('base_vapi', metavar='/path/to/frida-base.vapi', type=argparse.FileType('r', encoding='utf-8'))
|
||||
parser.add_argument('output_dir', metavar='/output/dir')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
output_type = args.output_type
|
||||
api_version = args.api_version
|
||||
core_header = args.core_header.read()
|
||||
core_gir = args.core_gir.read()
|
||||
core_vapi = args.core_vapi.read()
|
||||
core_header = args.core_header.read()
|
||||
base_vapi = args.base_vapi.read()
|
||||
base_header = args.base_header.read()
|
||||
base_gir = args.base_gir.read()
|
||||
base_vapi = args.base_vapi.read()
|
||||
output_dir = Path(args.output_dir)
|
||||
|
||||
if output_type == 'gir':
|
||||
(output_dir / f"Frida-{api_version}.gir").write_text(core_gir, encoding='utf-8')
|
||||
return
|
||||
|
||||
if output_type == 'vapi-stamp':
|
||||
(output_dir / f"frida-core-{api_version}.vapi.stamp").write_bytes(b"")
|
||||
return
|
||||
@@ -45,30 +61,36 @@ def main():
|
||||
toplevel_sources = []
|
||||
src_dir = Path(__file__).parent.parent.resolve()
|
||||
for name in toplevel_names:
|
||||
with open(src_dir / name, 'r', encoding='utf-8') as f:
|
||||
toplevel_sources.append(f.read())
|
||||
toplevel_sources.append((src_dir / name).read_text(encoding='utf-8'))
|
||||
toplevel_code = "\n".join(toplevel_sources)
|
||||
|
||||
enable_header = False
|
||||
enable_gir = False
|
||||
enable_vapi = False
|
||||
if output_type == 'bundle':
|
||||
enable_header = True
|
||||
enable_gir = True
|
||||
enable_vapi = True
|
||||
elif output_type == 'header':
|
||||
enable_header = True
|
||||
elif output_type == 'gir':
|
||||
enable_gir = True
|
||||
elif output_type == 'vapi':
|
||||
enable_vapi = True
|
||||
|
||||
api = parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, base_header)
|
||||
api = parse_api(api_version, toplevel_code, core_header, core_vapi, base_header, base_vapi)
|
||||
|
||||
if enable_header:
|
||||
emit_header(api, output_dir)
|
||||
|
||||
if enable_gir:
|
||||
emit_gir(api, core_gir, base_gir, output_dir)
|
||||
|
||||
if enable_vapi:
|
||||
emit_vapi(api, output_dir)
|
||||
|
||||
def emit_header(api, output_dir):
|
||||
with open(output_dir / 'frida-core.h', 'w', encoding='utf-8') as output_header_file:
|
||||
with OutputFile(output_dir / 'frida-core.h') as output_header_file:
|
||||
output_header_file.write("#ifndef __FRIDA_CORE_H__\n#define __FRIDA_CORE_H__\n\n")
|
||||
|
||||
output_header_file.write("#include <glib.h>\n#include <glib-object.h>\n#include <gio/gio.h>\n#include <json-glib/json-glib.h>\n")
|
||||
@@ -79,7 +101,6 @@ def emit_header(api, output_dir):
|
||||
output_header_file.write("\ntypedef struct _%s %s;" % (object_type.c_name, object_type.c_name))
|
||||
if object_type.c_iface_definition is not None:
|
||||
output_header_file.write("\ntypedef struct _%sIface %sIface;" % (object_type.c_name, object_type.c_name))
|
||||
output_header_file.write("\ntypedef struct _FridaHostSession FridaHostSession;")
|
||||
|
||||
for enum in api.enum_types:
|
||||
output_header_file.write("\n\n" + enum.c_definition)
|
||||
@@ -150,8 +171,64 @@ def emit_header(api, output_dir):
|
||||
|
||||
output_header_file.write("\n\n#endif\n")
|
||||
|
||||
def emit_gir(api: ApiSpec, core_gir: str, base_gir: str, output_dir: Path) -> str:
|
||||
ET.register_namespace("", CORE_NAMESPACE)
|
||||
ET.register_namespace("c", C_NAMESPACE)
|
||||
ET.register_namespace("glib", GLIB_NAMESPACE)
|
||||
|
||||
core_tree = ET.ElementTree(ET.fromstring(core_gir))
|
||||
base_tree = ET.ElementTree(ET.fromstring(base_gir))
|
||||
|
||||
core_root = core_tree.getroot()
|
||||
base_root = base_tree.getroot()
|
||||
|
||||
merged_root = ET.Element(core_root.tag, core_root.attrib)
|
||||
|
||||
for elem in core_root.findall("include", GIR_NAMESPACES):
|
||||
name = elem.get("name")
|
||||
if name in {"GLib", "GObject", "Gio"}:
|
||||
merged_root.append(elem)
|
||||
|
||||
for tag in ["package", "c:include"]:
|
||||
for elem in core_root.findall(tag, GIR_NAMESPACES):
|
||||
merged_root.append(elem)
|
||||
|
||||
core_namespace = core_root.find("namespace", GIR_NAMESPACES)
|
||||
merged_namespace = ET.SubElement(merged_root, core_namespace.tag, core_namespace.attrib)
|
||||
|
||||
object_type_names = {obj.name for obj in api.object_types}
|
||||
enum_type_names = {enum.name for enum in api.enum_types}
|
||||
error_type_names = {error.name for error in api.error_types}
|
||||
|
||||
def merge_and_transform_elements(tag_name: str, spec_set: Set[str]):
|
||||
core_elements = filter_elements(core_root.findall(f".//{tag_name}", GIR_NAMESPACES), spec_set)
|
||||
base_elements = filter_elements(base_root.findall(f".//{tag_name}", GIR_NAMESPACES), spec_set)
|
||||
for elem in core_elements + base_elements:
|
||||
if tag_name == "class":
|
||||
for child in list(elem):
|
||||
if (child.tag == CORE_TAG_IMPLEMENTS and child.get("name") == "FridaBase.AgentMessageSink") \
|
||||
or child.tag == CORE_TAG_FIELD \
|
||||
or child.get("name").startswith("_"):
|
||||
elem.remove(child)
|
||||
merged_namespace.append(elem)
|
||||
|
||||
merge_and_transform_elements("class", object_type_names)
|
||||
merge_and_transform_elements("interface", object_type_names)
|
||||
merge_and_transform_elements("enumeration", enum_type_names | error_type_names)
|
||||
|
||||
ET.indent(merged_root, space=" ")
|
||||
result = ET.tostring(merged_root,
|
||||
encoding="unicode",
|
||||
xml_declaration=True)
|
||||
result = result.replace("FridaBase.", "Frida.")
|
||||
with OutputFile(output_dir / f"Frida-{api.version}.gir") as output_gir:
|
||||
output_gir.write(result)
|
||||
|
||||
def filter_elements(elements: List[ET.Element], spec_set: Set[str]):
|
||||
return [elem for elem in elements if elem.get("name") in spec_set]
|
||||
|
||||
def emit_vapi(api, output_dir):
|
||||
with open(output_dir / "frida-core-{0}.vapi".format(api.version), "w", encoding='utf-8') as output_vapi_file:
|
||||
with OutputFile(output_dir / f"frida-core-{api.version}.vapi") as output_vapi_file:
|
||||
output_vapi_file.write("[CCode (cheader_filename = \"frida-core.h\", cprefix = \"Frida\", lower_case_cprefix = \"frida_\")]")
|
||||
output_vapi_file.write("\nnamespace Frida {")
|
||||
output_vapi_file.write("\n\tpublic static void init ();")
|
||||
@@ -189,12 +266,12 @@ def emit_vapi(api, output_dir):
|
||||
|
||||
output_vapi_file.write("\n}\n")
|
||||
|
||||
with open(output_dir / "frida-core-{0}.deps".format(api.version), "w", encoding='utf-8') as output_deps_file:
|
||||
with OutputFile(output_dir / f"frida-core-{api.version}.deps") as output_deps_file:
|
||||
output_deps_file.write("glib-2.0\n")
|
||||
output_deps_file.write("gobject-2.0\n")
|
||||
output_deps_file.write("gio-2.0\n")
|
||||
|
||||
def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, base_header):
|
||||
def parse_api(api_version, toplevel_code, core_header, core_vapi, base_header, base_vapi):
|
||||
all_headers = core_header + "\n" + base_header
|
||||
|
||||
all_enum_names = [m.group(1) for m in re.finditer(r"^\t+public\s+enum\s+(\w+)\s+", toplevel_code + "\n" + base_vapi, re.MULTILINE)]
|
||||
@@ -217,12 +294,18 @@ def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, bas
|
||||
"StaticAuthenticationService": "AuthenticationService",
|
||||
}
|
||||
internal_type_prefixes = [
|
||||
"AgentMessageKind",
|
||||
"Fruity",
|
||||
"HostSession",
|
||||
"MessageType",
|
||||
"PeerSetup",
|
||||
"PortConflictBehavior",
|
||||
"ResultCode",
|
||||
"SpawnStartState",
|
||||
"State",
|
||||
"StringTerminator",
|
||||
"UnloadPolicy",
|
||||
"WebService",
|
||||
"Winjector"
|
||||
]
|
||||
seen_enum_names = set()
|
||||
@@ -287,8 +370,7 @@ def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, bas
|
||||
method_cname_lc = object_type.c_name_lc + '_' + method_name
|
||||
if method_cname_lc not in seen_cfunctions:
|
||||
seen_cfunctions.add(method_cname_lc)
|
||||
if method_name not in ('construct', 'construct_with_host_session', 'get_main_context', 'get_provider', 'get_session') \
|
||||
and not (object_type.name in ("Session", "Script") and method_name == 'get_id'):
|
||||
if method_name != 'construct':
|
||||
if (object_type.c_name + '*') in m.group(0):
|
||||
if method_name == 'new' or method_name.startswith('new_'):
|
||||
object_type.c_constructors.append(method_cprototype)
|
||||
@@ -305,7 +387,7 @@ def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, bas
|
||||
if delegate_cname not in seen_cdelegates:
|
||||
seen_cdelegates.add(delegate_cname)
|
||||
object_type.c_delegate_typedefs.append(beautify_cprototype(d.group(0)))
|
||||
if object_type.kind == 'interface' and object_type.name != "Injector":
|
||||
if object_type.kind == 'interface':
|
||||
for m in re.finditer("^(struct _" + object_type.c_name + "Iface {[^}]+};)$", all_headers, re.MULTILINE):
|
||||
object_type.c_iface_definition = beautify_cinterface(m.group(1))
|
||||
|
||||
@@ -327,8 +409,10 @@ def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, bas
|
||||
if stripped_line == "}":
|
||||
ignoring = False
|
||||
else:
|
||||
if stripped_line.startswith("public abstract") or stripped_line.startswith("public class Promise") \
|
||||
or stripped_line.startswith("public interface Future"):
|
||||
if stripped_line.startswith("public abstract") \
|
||||
or stripped_line.startswith("public class Promise") \
|
||||
or stripped_line.startswith("public interface Future") \
|
||||
or stripped_line.startswith("public class CF"):
|
||||
ignoring = True
|
||||
elif stripped_line.startswith("public enum") or stripped_line.startswith("public errordomain"):
|
||||
name = re.match(r"^public (?:enum|errordomain) (\w+) ", stripped_line).group(1)
|
||||
@@ -340,8 +424,8 @@ def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, bas
|
||||
current_enum.vapi_declaration = stripped_line
|
||||
else:
|
||||
ignoring = True
|
||||
elif stripped_line.startswith("public class") or stripped_line.startswith("public interface"):
|
||||
name = re.match(r"^public (class|interface) (\w+) ", stripped_line).group(2)
|
||||
elif (match := OBJECT_TYPE_PATTERN.match(stripped_line)) is not None:
|
||||
name = match.group(3)
|
||||
if name not in object_type_by_name:
|
||||
ignoring = True
|
||||
else:
|
||||
@@ -360,8 +444,7 @@ def parse_api(api_version, toplevel_code, core_vapi, core_header, base_vapi, bas
|
||||
current_object_type.vapi_signals.append(stripped_line)
|
||||
elif "{ get" in stripped_line:
|
||||
name = re.match(r".+?(\w+)\s+{", stripped_line).group(1)
|
||||
if name not in ('main_context', 'provider', 'session'):
|
||||
current_object_type.vapi_properties.append(stripped_line)
|
||||
current_object_type.vapi_properties.append(stripped_line)
|
||||
else:
|
||||
m = re.match(r".+?(\w+)\s+\(", stripped_line)
|
||||
if m is not None:
|
||||
@@ -398,19 +481,19 @@ def function_is_public(name):
|
||||
"negotiate_connection"
|
||||
]
|
||||
|
||||
def parse_vala_object_types(source):
|
||||
return [ApiObjectType(m.group(2), m.group(1)) for m in re.finditer(r"^\t+public\s+(class|interface)\s+(\w+)\s+", source, re.MULTILINE)]
|
||||
def parse_vala_object_types(source) -> List[ApiObjectType]:
|
||||
return [ApiObjectType(m.group(3), m.group(2)) for m in OBJECT_TYPE_PATTERN.finditer(source, re.MULTILINE)]
|
||||
|
||||
def parse_vapi_functions(vapi):
|
||||
def parse_vapi_functions(vapi) -> List[ApiFunction]:
|
||||
return [ApiFunction(m.group(1), m.group(0)) for m in re.finditer(r"^\tpublic static .+ (\w+) \(.+;", vapi, re.MULTILINE)]
|
||||
|
||||
@dataclass
|
||||
class ApiSpec:
|
||||
def __init__(self, version, object_types, functions, enum_types, error_types):
|
||||
self.version = version
|
||||
self.object_types = object_types
|
||||
self.functions = functions
|
||||
self.enum_types = enum_types
|
||||
self.error_types = error_types
|
||||
version: str
|
||||
object_types: List[ApiObjectType]
|
||||
functions: List[ApiFunction]
|
||||
enum_types: List[ApiEnum]
|
||||
error_types: List[ApiEnum]
|
||||
|
||||
class ApiEnum:
|
||||
def __init__(self, name):
|
||||
@@ -512,6 +595,23 @@ def fuzzysort(items, keys):
|
||||
result.extend(remaining)
|
||||
return result
|
||||
|
||||
class OutputFile:
|
||||
def __init__(self, output_path):
|
||||
self._output_path = output_path
|
||||
self._io = StringIO()
|
||||
|
||||
def __enter__(self):
|
||||
return self._io
|
||||
|
||||
def __exit__(self, *exc):
|
||||
result = self._io.getvalue()
|
||||
if self._output_path.exists():
|
||||
existing_contents = self._output_path.read_text(encoding='utf-8')
|
||||
if existing_contents == result:
|
||||
return False
|
||||
self._output_path.write_text(result, encoding='utf-8')
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
+37
-48
@@ -1,55 +1,45 @@
|
||||
fs = import('fs')
|
||||
|
||||
generate_api = [python, files('generate.py')]
|
||||
|
||||
generate_api_args = [
|
||||
api_version,
|
||||
core_build_dir / 'frida-core.h',
|
||||
core_build_dir / core_gir_name,
|
||||
core_build_dir / 'frida-core.vapi',
|
||||
core_build_dir / 'frida-core.h',
|
||||
base_build_dir / f'frida-base-@[email protected]',
|
||||
base_build_dir / 'frida-base.h',
|
||||
base_build_dir / base_gir_name,
|
||||
base_build_dir / f'frida-base-@[email protected]',
|
||||
meson.current_build_dir(),
|
||||
]
|
||||
|
||||
core_public_h = custom_target('frida-core-header',
|
||||
input: [core, base],
|
||||
output: ['frida-core.h'],
|
||||
command: [
|
||||
generate_api,
|
||||
'--output=header',
|
||||
generate_api_args,
|
||||
],
|
||||
install: true,
|
||||
install_dir: header_install_dir,
|
||||
)
|
||||
|
||||
core_public_gir = custom_target('frida-core-gir',
|
||||
input: [core, base],
|
||||
output: [core_gir_name],
|
||||
command: [
|
||||
generate_api,
|
||||
'--output=gir',
|
||||
generate_api_args,
|
||||
],
|
||||
install: true,
|
||||
install_dir: girdir,
|
||||
)
|
||||
|
||||
core_public_vapi = custom_target('frida-core-vapi',
|
||||
core_api = custom_target('frida-core-api',
|
||||
input: [core, base],
|
||||
output: [
|
||||
'frida-core.h',
|
||||
core_gir_name,
|
||||
f'frida-core-@[email protected]',
|
||||
f'frida-core-@[email protected]',
|
||||
],
|
||||
command: [
|
||||
generate_api,
|
||||
'--output=vapi',
|
||||
'--output=bundle',
|
||||
generate_api_args,
|
||||
],
|
||||
install: true,
|
||||
install_dir: vapidir,
|
||||
install_dir: [header_install_dir, girdir, vapidir, vapidir],
|
||||
)
|
||||
|
||||
core_public_vapi_stamp = custom_target('frida-core-vapi-stamp',
|
||||
core_public_h = core_api[0]
|
||||
core_public_gir = core_api[1]
|
||||
core_public_vapi = [core_api[2], core_api[3]]
|
||||
|
||||
install_glib_girs = not gi_dep.found() and not fs.exists(girdir / 'GLib-2.0.gir')
|
||||
glib_gir = fs.copyfile('GLib-2.0.gir', install: install_glib_girs, install_dir: girdir)
|
||||
gobject_gir = fs.copyfile('GObject-2.0.gir', install: install_glib_girs, install_dir: girdir)
|
||||
gio_gir = fs.copyfile('Gio-2.0.gir', install: install_glib_girs, install_dir: girdir)
|
||||
|
||||
core_public_vapi_stamp = custom_target('frida-core-vapi-stamp',
|
||||
input: core_public_vapi,
|
||||
output: f'frida-core-@[email protected]',
|
||||
command: [
|
||||
@@ -76,8 +66,6 @@ core_public_lib = custom_target('frida-core-library',
|
||||
install_dir: get_option('libdir'),
|
||||
)
|
||||
|
||||
fs = import('fs')
|
||||
|
||||
core_public_extra_headers = []
|
||||
if host_os == 'android'
|
||||
core_public_extra_headers += fs.copyfile(frida_selinux_h)
|
||||
@@ -88,19 +76,28 @@ if build_machine.system() == 'windows'
|
||||
else
|
||||
uninstalled_incdir = meson.current_build_dir()
|
||||
endif
|
||||
uninstalled_girdir = uninstalled_incdir
|
||||
uninstalled_vapidir = uninstalled_incdir
|
||||
|
||||
uninstalled_variables = {
|
||||
'frida_includedir': uninstalled_incdir,
|
||||
'frida_girdir': uninstalled_girdir,
|
||||
'frida_vapidir': uninstalled_vapidir,
|
||||
}
|
||||
|
||||
installed_variables = {
|
||||
'frida_includedir': '${includedir}',
|
||||
'frida_girdir': girdir,
|
||||
'frida_vapidir': vapidir,
|
||||
}
|
||||
|
||||
core_public_dep = declare_dependency(
|
||||
sources: [core_public_h, core_public_gir, core_public_vapi_stamp, core_public_extra_headers],
|
||||
sources: [core_public_h, core_public_gir, glib_gir, gobject_gir, gio_gir, core_public_vapi_stamp, core_public_extra_headers],
|
||||
include_directories: include_directories('.'),
|
||||
link_args: backend_libs_private,
|
||||
link_with: core_public_lib,
|
||||
dependencies: core_deps,
|
||||
variables: {
|
||||
'frida_includedir': uninstalled_incdir,
|
||||
'frida_girdir': uninstalled_girdir,
|
||||
'frida_vapidir': uninstalled_vapidir,
|
||||
},
|
||||
variables: uninstalled_variables,
|
||||
)
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
@@ -115,16 +112,8 @@ pkg.generate(
|
||||
libraries: core_public_lib,
|
||||
libraries_private: backend_libs_private,
|
||||
extra_cflags: ['-I${frida_includedir}'],
|
||||
variables: {
|
||||
'frida_includedir': '${includedir}',
|
||||
'frida_girdir': girdir,
|
||||
'frida_vapidir': vapidir,
|
||||
},
|
||||
uninstalled_variables: {
|
||||
'frida_includedir': uninstalled_incdir,
|
||||
'frida_girdir': uninstalled_girdir,
|
||||
'frida_vapidir': uninstalled_vapidir,
|
||||
},
|
||||
variables: installed_variables,
|
||||
uninstalled_variables: uninstalled_variables,
|
||||
)
|
||||
|
||||
meson.override_dependency(f'frida-core-@api_version@', core_public_dep)
|
||||
@@ -17,7 +17,7 @@ namespace Frida.Barebone {
|
||||
public abstract async void deallocate (Cancellable? cancellable) throws Error, IOError;
|
||||
}
|
||||
|
||||
public class SimpleAllocator : Object, Allocator {
|
||||
public sealed class SimpleAllocator : Object, Allocator {
|
||||
public size_t page_size {
|
||||
get { return _page_size; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class ArmMachine : Object, Machine {
|
||||
public sealed class ArmMachine : Object, Machine {
|
||||
public override GDB.Client gdb {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class Arm64Machine : Object, Machine {
|
||||
public sealed class Arm64Machine : Object, Machine {
|
||||
public override GDB.Client gdb {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class UnknownMachine : Object, Machine {
|
||||
public sealed class UnknownMachine : Object, Machine {
|
||||
public GDB.Client gdb {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class IA32Machine : Object, Machine {
|
||||
public sealed class IA32Machine : Object, Machine {
|
||||
public override GDB.Client gdb {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class X64Machine : Object, Machine {
|
||||
public sealed class X64Machine : Object, Machine {
|
||||
public override GDB.Client gdb {
|
||||
get;
|
||||
set;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class BareboneHostSessionBackend : Object, HostSessionBackend {
|
||||
public sealed class BareboneHostSessionBackend : Object, HostSessionBackend {
|
||||
private BareboneHostSessionProvider? provider;
|
||||
|
||||
private const uint16 DEFAULT_PORT = 3333;
|
||||
@@ -30,7 +30,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class BareboneHostSessionProvider : Object, HostSessionProvider {
|
||||
public sealed class BareboneHostSessionProvider : Object, HostSessionProvider {
|
||||
public string id {
|
||||
get { return "barebone"; }
|
||||
}
|
||||
@@ -141,12 +141,35 @@ namespace Frida {
|
||||
return yield this.host_session.link_agent_session (id, sink, cancellable);
|
||||
}
|
||||
|
||||
public void unlink_agent_session (HostSession host_session, AgentSessionId id) {
|
||||
if (host_session != this.host_session)
|
||||
return;
|
||||
|
||||
this.host_session.unlink_agent_session (id);
|
||||
}
|
||||
|
||||
public async IOStream link_channel (HostSession host_session, ChannelId id, Cancellable? cancellable)
|
||||
throws Error, IOError {
|
||||
throw new Error.NOT_SUPPORTED ("Channels are not supported by this backend");
|
||||
}
|
||||
|
||||
public void unlink_channel (HostSession host_session, ChannelId id) {
|
||||
}
|
||||
|
||||
public async ServiceSession link_service_session (HostSession host_session, ServiceSessionId id, Cancellable? cancellable)
|
||||
throws Error, IOError {
|
||||
throw new Error.NOT_SUPPORTED ("Services are not supported by this backend");
|
||||
}
|
||||
|
||||
public void unlink_service_session (HostSession host_session, ServiceSessionId id) {
|
||||
}
|
||||
|
||||
private void on_agent_session_detached (AgentSessionId id, SessionDetachReason reason, CrashInfo crash) {
|
||||
agent_session_detached (id, reason, crash);
|
||||
}
|
||||
}
|
||||
|
||||
public class BareboneHostSession : Object, HostSession {
|
||||
public sealed class BareboneHostSession : Object, HostSession {
|
||||
public Barebone.Services services {
|
||||
get;
|
||||
construct;
|
||||
@@ -260,6 +283,14 @@ namespace Frida {
|
||||
return session;
|
||||
}
|
||||
|
||||
public void unlink_agent_session (AgentSessionId id) {
|
||||
BareboneAgentSession? session = agent_sessions[id];
|
||||
if (session == null)
|
||||
return;
|
||||
|
||||
session.message_sink = null;
|
||||
}
|
||||
|
||||
public async InjectorPayloadId inject_library_file (uint pid, string path, string entrypoint, string data,
|
||||
Cancellable? cancellable) throws Error, IOError {
|
||||
throw_not_supported ();
|
||||
@@ -270,6 +301,14 @@ namespace Frida {
|
||||
throw_not_supported ();
|
||||
}
|
||||
|
||||
public async ChannelId open_channel (string address, Cancellable? cancellable) throws Error, IOError {
|
||||
throw new Error.NOT_SUPPORTED ("Channels are not supported by this backend");
|
||||
}
|
||||
|
||||
public async ServiceSessionId open_service (string address, Cancellable? cancellable) throws Error, IOError {
|
||||
throw new Error.NOT_SUPPORTED ("Services are not supported by this backend");
|
||||
}
|
||||
|
||||
private void on_agent_session_closed (BareboneAgentSession session) {
|
||||
AgentSessionId id = session.id;
|
||||
|
||||
@@ -282,7 +321,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class BareboneAgentSession : Object, AgentSession {
|
||||
private sealed class BareboneAgentSession : Object, AgentSession {
|
||||
public signal void closed ();
|
||||
|
||||
public AgentSessionId id {
|
||||
@@ -525,7 +564,7 @@ namespace Frida {
|
||||
}
|
||||
|
||||
namespace Barebone {
|
||||
public class Services : Object {
|
||||
public sealed class Services : Object {
|
||||
public Machine machine {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class Callback : Object {
|
||||
public sealed class Callback : Object {
|
||||
private uint64 code;
|
||||
private CallbackHandler handler;
|
||||
private Machine machine;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main(argv):
|
||||
output_dir, priv_dir, input_dir, npm = [Path(d).resolve() for d in argv[1:]]
|
||||
|
||||
try:
|
||||
generate_runtime(output_dir, priv_dir, input_dir, npm)
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def generate_runtime(output_dir, priv_dir, input_dir, npm):
|
||||
priv_dir.mkdir(exist_ok=True)
|
||||
|
||||
shutil.copy(input_dir / "package.json", priv_dir)
|
||||
shutil.copy(input_dir / "package-lock.json", priv_dir)
|
||||
|
||||
runtime_reldir = Path("script-runtime")
|
||||
runtime_srcdir = input_dir / runtime_reldir
|
||||
runtime_intdir = priv_dir / runtime_reldir
|
||||
if runtime_intdir.exists():
|
||||
shutil.rmtree(runtime_intdir)
|
||||
shutil.copytree(runtime_srcdir, runtime_intdir)
|
||||
|
||||
subprocess.run([npm, "install"], capture_output=True, cwd=priv_dir, check=True)
|
||||
|
||||
shutil.copy(priv_dir / "script-runtime.js", output_dir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
public class Interceptor : Object {
|
||||
public sealed class Interceptor : Object {
|
||||
public Machine machine {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -29,11 +29,11 @@ barebone_script_runtime = custom_target('frida-barebone-script-runtime',
|
||||
],
|
||||
command: [
|
||||
python,
|
||||
files('generate-script-runtime.py'),
|
||||
meson.current_build_dir(),
|
||||
compile_js_agent,
|
||||
'@OUTPUT@',
|
||||
'@PRIVATE_DIR@',
|
||||
meson.current_source_dir(),
|
||||
npm,
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
backend_sources += custom_target('frida-data-barebone',
|
||||
|
||||
Generated
+32
-21
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "frida-barebone-runtime",
|
||||
"name": "frida-barebone-script-runtime",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "frida-barebone-runtime",
|
||||
"name": "frida-barebone-script-runtime",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"@types/frida-gum": "^18.3.2",
|
||||
"frida-compile": "^16.2.1"
|
||||
"@types/frida-gum": "^19.0.0",
|
||||
"frida-compile": "^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/assert": {
|
||||
@@ -74,6 +74,13 @@
|
||||
"node": ">=14.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/crypto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@frida/crypto/-/crypto-1.0.1.tgz",
|
||||
"integrity": "sha512-WXTkVjESvX8TIVXIynJJv9BKSIdQP0Iis04StIXknkDi1ULdMlrypA9p5C4KW1H6GCkNsVnKbybpzsulYCTvag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/diagnostics_channel": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/diagnostics_channel/-/diagnostics_channel-1.0.0.tgz",
|
||||
@@ -316,10 +323,11 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/frida-gum": {
|
||||
"version": "18.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-18.3.2.tgz",
|
||||
"integrity": "sha512-bso8bJRxrhchNRrOMmT18st/THIdjzxFdcMtJ/gGSYSknJeerQ8ArBwBtlWt/f3pqVVs1Mz1Fg6lvUdjXswa+g==",
|
||||
"dev": true
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-19.0.0.tgz",
|
||||
"integrity": "sha512-qViK1KwvPEAkajwSUv0wpZvZLiX8xO4JFFCh8dfYZfzSyOEfoE0KliCP/nJSKIKG6N3hXnPowrvPufjs5fLKAA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "17.0.45",
|
||||
@@ -366,24 +374,26 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/frida-compile": {
|
||||
"version": "16.2.1",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-16.2.1.tgz",
|
||||
"integrity": "sha512-be/U5h8l0cb0b+fWeZclhfw1s2xER8fPOjnTU4rZF8oh5GkB0BeAEaApwfGrdmeZkVNdUhDLXud7DqEljHRWmA==",
|
||||
"version": "17.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-17.0.0.tgz",
|
||||
"integrity": "sha512-ixJRj14qLH/Z0ckFWd5fKeDMm0W2+2WDpSGnLRgpn0nuCQAbDHRCqVCWtPnV8uzPJmA6XOX0pujsMpYe9q9RRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@frida/assert": "^3.0.1",
|
||||
"@frida/base64-js": "^2.0.3",
|
||||
"@frida/buffer": "^7.0.4",
|
||||
"@frida/crosspath": "^3.0.0",
|
||||
"@frida/crypto": "^1.0.1",
|
||||
"@frida/diagnostics_channel": "^1.0.0",
|
||||
"@frida/events": "^4.0.4",
|
||||
"@frida/http": "^4.0.2",
|
||||
@@ -406,8 +416,8 @@
|
||||
"@frida/url": "^1.0.2",
|
||||
"@frida/util": "^1.0.3",
|
||||
"@frida/vm": "^2.0.0",
|
||||
"commander": "^9.4.0",
|
||||
"frida-fs": "^5.2.3",
|
||||
"commander": "^11.1.0",
|
||||
"frida-fs": "^6.0.0",
|
||||
"typed-emitter": "^2.1.0"
|
||||
},
|
||||
"bin": {
|
||||
@@ -415,10 +425,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/frida-fs": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-5.2.3.tgz",
|
||||
"integrity": "sha512-jJhtNI86UqDkOtB72XR7Ia9KHudQUxIFIbZadS9kxrDU6Io1jLhoMNp++iW7n7MaDgFQLRR8VgNj9VViGzaydA==",
|
||||
"dev": true
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-6.0.0.tgz",
|
||||
"integrity": "sha512-I0fnKupZh7fU2ixwCIjJnEqNdhfm/SC1ZYBMy58EmeqOWSbjw1Dpy99mJ7BJdbk2KNXJeaBZGxDYLtn0J9S+UA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/http-parser-js": {
|
||||
"version": "0.5.8",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"build": "frida-compile script-runtime/entrypoint.ts -o script-runtime.js -c"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/frida-gum": "^18.3.2",
|
||||
"frida-compile": "^16.2.1"
|
||||
"@types/frida-gum": "^19.0.0",
|
||||
"frida-compile": "^17.0.0"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaBarebone", gir_version = "1.0")]
|
||||
namespace Frida.Barebone {
|
||||
private class RustModule : Object {
|
||||
private sealed class RustModule : Object {
|
||||
public signal void console_output (string message);
|
||||
|
||||
public Gee.List<Export> exports {
|
||||
|
||||
@@ -278,6 +278,8 @@ Object.defineProperties(Process, {
|
||||
base: NULL,
|
||||
size: 0x1000,
|
||||
path: "/kernel",
|
||||
ensureInitialized() {
|
||||
},
|
||||
enumerateImports() {
|
||||
return [];
|
||||
},
|
||||
@@ -290,11 +292,23 @@ Object.defineProperties(Process, {
|
||||
enumerateRanges() {
|
||||
return [];
|
||||
},
|
||||
enumerateSections() {
|
||||
return [];
|
||||
},
|
||||
enumerateDependencies() {
|
||||
return [];
|
||||
},
|
||||
findExportByName() {
|
||||
return null;
|
||||
},
|
||||
getExportByName(exportName) {
|
||||
throw new Error(`unable to find export '${exportName}'`);
|
||||
getExportByName(name) {
|
||||
throw new Error(`unable to find export '${name}'`);
|
||||
},
|
||||
findSymbolByName() {
|
||||
return null;
|
||||
},
|
||||
getSymbolByName(name) {
|
||||
throw new Error(`unable to find symbol '${name}'`);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
private class BareboneScript : Object {
|
||||
private sealed class BareboneScript : Object {
|
||||
public signal void message (string json, Bytes? data);
|
||||
|
||||
public AgentScriptId id {
|
||||
@@ -420,7 +420,9 @@ namespace Frida {
|
||||
|
||||
public void post (string json, Bytes? data) {
|
||||
var json_val = ctx.make_string (json);
|
||||
invoke_void (dispatch_message_func, { json_val }, runtime_obj);
|
||||
var data_val = (data != null) ? ctx.make_array_buffer (data.get_data ()) : QuickJS.Null;
|
||||
invoke_void (dispatch_message_func, { json_val, data_val }, runtime_obj);
|
||||
ctx.free_value (data_val);
|
||||
ctx.free_value (json_val);
|
||||
|
||||
perform_pending_io ();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class Compiler : Object {
|
||||
public sealed class Compiler : Object {
|
||||
public signal void starting ();
|
||||
public signal void finished ();
|
||||
public signal void output (string bundle);
|
||||
@@ -199,7 +199,7 @@ namespace Frida {
|
||||
try {
|
||||
var device = yield manager.get_device_by_type (LOCAL, 0, io_cancellable);
|
||||
var session = yield device.get_host_session (io_cancellable);
|
||||
var agent = new Agent (this, (BaseDBusHostSession) session);
|
||||
var agent = new Agent (this, (LocalHostSession) session);
|
||||
|
||||
load_request.resolve (agent);
|
||||
} catch (GLib.Error e) {
|
||||
@@ -238,7 +238,7 @@ namespace Frida {
|
||||
private Promise<string> source_request = new Promise<string> ();
|
||||
private Promise<Bytes?> snapshot_request = new Promise<Bytes?> ();
|
||||
|
||||
public Agent (Compiler parent, BaseDBusHostSession host_session) {
|
||||
public Agent (Compiler parent, LocalHostSession host_session) {
|
||||
Object (
|
||||
parent: parent,
|
||||
host_session: host_session,
|
||||
@@ -275,7 +275,7 @@ namespace Frida {
|
||||
new Json.Node.alloc ().init_string (entrypoint),
|
||||
new Json.Node.alloc ().init_string (opts.source_maps.to_nick ()),
|
||||
new Json.Node.alloc ().init_string (opts.compression.to_nick ()),
|
||||
}, cancellable);
|
||||
}, null, cancellable);
|
||||
return bundle.get_string ();
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Frida {
|
||||
new Json.Node.alloc ().init_string (entrypoint),
|
||||
new Json.Node.alloc ().init_string (opts.source_maps.to_nick ()),
|
||||
new Json.Node.alloc ().init_string (opts.compression.to_nick ()),
|
||||
}, cancellable);
|
||||
}, null, cancellable);
|
||||
}
|
||||
|
||||
private static string compute_project_root (string entrypoint, CompilerOptions options) {
|
||||
@@ -465,10 +465,10 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class BuildOptions : CompilerOptions {
|
||||
public sealed class BuildOptions : CompilerOptions {
|
||||
}
|
||||
|
||||
public class WatchOptions : CompilerOptions {
|
||||
public sealed class WatchOptions : CompilerOptions {
|
||||
}
|
||||
|
||||
public enum SourceMaps {
|
||||
|
||||
@@ -3,13 +3,7 @@ compiler_sources = files(
|
||||
)
|
||||
|
||||
if have_compiler_backend
|
||||
if get_option('compiler_snapshot').auto()
|
||||
# Generating our snapshot with V8's CPU simulator takes a very long time.
|
||||
use_snapshot = meson.can_run_host_binaries()
|
||||
else
|
||||
use_snapshot = get_option('compiler_snapshot').enabled()
|
||||
endif
|
||||
compiler_mksnapshot = use_snapshot ? v8_mksnapshot : ''
|
||||
compiler_mksnapshot = generate_compiler_snapshot ? v8_mksnapshot : ''
|
||||
|
||||
compiler_agent = custom_target('frida-compiler-agent',
|
||||
input: [
|
||||
|
||||
Generated
+41
-24
@@ -9,15 +9,15 @@
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@frida/crosspath": "3.0.0",
|
||||
"frida-compile": "16.4.1",
|
||||
"frida-fs": "5.2.5"
|
||||
"frida-compile": "17.0.0",
|
||||
"frida-fs": "6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@frida/rollup-plugin-node-polyfills": "^1.0.3",
|
||||
"@rollup/plugin-node-resolve": "^14.1.0",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@rollup/plugin-typescript": "^8.3.4",
|
||||
"@types/frida-gum": "18.7.0",
|
||||
"@types/frida-gum": "19.0.0",
|
||||
"@types/glob": "^8.0.0",
|
||||
"@types/node": "18.7.23",
|
||||
"glob": "^8.0.3",
|
||||
@@ -252,6 +252,13 @@
|
||||
"frida-fs": "^5.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/rollup-plugin-node-polyfills/node_modules/frida-fs": {
|
||||
"version": "5.2.5",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-5.2.5.tgz",
|
||||
"integrity": "sha512-Eyb4OqUlcv1/Eq7Q+B9IZmYZIgIM2YjqDojrjmAGzPSSXBuUKwSkuObQcQ8Dup9JTOMIUcSII9/I8DaTe6LFKw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/stream": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/stream/-/stream-1.0.2.tgz",
|
||||
@@ -468,10 +475,11 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/frida-gum": {
|
||||
"version": "18.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-18.7.0.tgz",
|
||||
"integrity": "sha512-HhBomXE23fLDAWXEKi3BjJLrlH9wAv9IEQNfO/PaYHQNNbh0Bi06gx6JbXTspVpbqlbVqkWAuU7n6HaS9B6yXA==",
|
||||
"dev": true
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-19.0.0.tgz",
|
||||
"integrity": "sha512-qViK1KwvPEAkajwSUv0wpZvZLiX8xO4JFFCh8dfYZfzSyOEfoE0KliCP/nJSKIKG6N3hXnPowrvPufjs5fLKAA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/glob": {
|
||||
"version": "8.0.0",
|
||||
@@ -640,9 +648,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/frida-compile": {
|
||||
"version": "16.4.1",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-16.4.1.tgz",
|
||||
"integrity": "sha512-xI9HNtUFpHxuKBGXaL6XJAYH1zWTvNJDrHRnz1hp0oS24iPHt6c01Jmm3qljZek3oQWn8HhvfNvrzfgbsKzoBQ==",
|
||||
"version": "17.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-17.0.0.tgz",
|
||||
"integrity": "sha512-ixJRj14qLH/Z0ckFWd5fKeDMm0W2+2WDpSGnLRgpn0nuCQAbDHRCqVCWtPnV8uzPJmA6XOX0pujsMpYe9q9RRw==",
|
||||
"dependencies": {
|
||||
"@frida/assert": "^3.0.1",
|
||||
"@frida/base64-js": "^2.0.3",
|
||||
@@ -672,7 +680,7 @@
|
||||
"@frida/util": "^1.0.3",
|
||||
"@frida/vm": "^2.0.0",
|
||||
"commander": "^11.1.0",
|
||||
"frida-fs": "^5.2.3",
|
||||
"frida-fs": "^6.0.0",
|
||||
"typed-emitter": "^2.1.0"
|
||||
},
|
||||
"bin": {
|
||||
@@ -680,9 +688,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/frida-fs": {
|
||||
"version": "5.2.5",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-5.2.5.tgz",
|
||||
"integrity": "sha512-Eyb4OqUlcv1/Eq7Q+B9IZmYZIgIM2YjqDojrjmAGzPSSXBuUKwSkuObQcQ8Dup9JTOMIUcSII9/I8DaTe6LFKw=="
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-6.0.0.tgz",
|
||||
"integrity": "sha512-I0fnKupZh7fU2ixwCIjJnEqNdhfm/SC1ZYBMy58EmeqOWSbjw1Dpy99mJ7BJdbk2KNXJeaBZGxDYLtn0J9S+UA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
@@ -1289,6 +1298,14 @@
|
||||
"@frida/vm": "^2.0.0",
|
||||
"@rollup/plugin-inject": "^4.0.4",
|
||||
"frida-fs": "^5.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"frida-fs": {
|
||||
"version": "5.2.5",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-5.2.5.tgz",
|
||||
"integrity": "sha512-Eyb4OqUlcv1/Eq7Q+B9IZmYZIgIM2YjqDojrjmAGzPSSXBuUKwSkuObQcQ8Dup9JTOMIUcSII9/I8DaTe6LFKw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@frida/stream": {
|
||||
@@ -1465,9 +1482,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/frida-gum": {
|
||||
"version": "18.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-18.7.0.tgz",
|
||||
"integrity": "sha512-HhBomXE23fLDAWXEKi3BjJLrlH9wAv9IEQNfO/PaYHQNNbh0Bi06gx6JbXTspVpbqlbVqkWAuU7n6HaS9B6yXA==",
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-19.0.0.tgz",
|
||||
"integrity": "sha512-qViK1KwvPEAkajwSUv0wpZvZLiX8xO4JFFCh8dfYZfzSyOEfoE0KliCP/nJSKIKG6N3hXnPowrvPufjs5fLKAA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/glob": {
|
||||
@@ -1596,9 +1613,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"frida-compile": {
|
||||
"version": "16.4.1",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-16.4.1.tgz",
|
||||
"integrity": "sha512-xI9HNtUFpHxuKBGXaL6XJAYH1zWTvNJDrHRnz1hp0oS24iPHt6c01Jmm3qljZek3oQWn8HhvfNvrzfgbsKzoBQ==",
|
||||
"version": "17.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-17.0.0.tgz",
|
||||
"integrity": "sha512-ixJRj14qLH/Z0ckFWd5fKeDMm0W2+2WDpSGnLRgpn0nuCQAbDHRCqVCWtPnV8uzPJmA6XOX0pujsMpYe9q9RRw==",
|
||||
"requires": {
|
||||
"@frida/assert": "^3.0.1",
|
||||
"@frida/base64-js": "^2.0.3",
|
||||
@@ -1628,14 +1645,14 @@
|
||||
"@frida/util": "^1.0.3",
|
||||
"@frida/vm": "^2.0.0",
|
||||
"commander": "^11.1.0",
|
||||
"frida-fs": "^5.2.3",
|
||||
"frida-fs": "^6.0.0",
|
||||
"typed-emitter": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"frida-fs": {
|
||||
"version": "5.2.5",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-5.2.5.tgz",
|
||||
"integrity": "sha512-Eyb4OqUlcv1/Eq7Q+B9IZmYZIgIM2YjqDojrjmAGzPSSXBuUKwSkuObQcQ8Dup9JTOMIUcSII9/I8DaTe6LFKw=="
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-6.0.0.tgz",
|
||||
"integrity": "sha512-I0fnKupZh7fU2ixwCIjJnEqNdhfm/SC1ZYBMy58EmeqOWSbjw1Dpy99mJ7BJdbk2KNXJeaBZGxDYLtn0J9S+UA=="
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@frida/crosspath": "3.0.0",
|
||||
"frida-compile": "16.4.1",
|
||||
"frida-fs": "5.2.5"
|
||||
"frida-compile": "17.0.0",
|
||||
"frida-fs": "6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@frida/rollup-plugin-node-polyfills": "^1.0.3",
|
||||
"@rollup/plugin-node-resolve": "^14.1.0",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@rollup/plugin-typescript": "^8.3.4",
|
||||
"@types/frida-gum": "18.7.0",
|
||||
"@types/frida-gum": "19.0.0",
|
||||
"@types/glob": "^8.0.0",
|
||||
"@types/node": "18.7.23",
|
||||
"glob": "^8.0.3",
|
||||
|
||||
+520
-303
File diff suppressed because it is too large.
Load diff
@@ -21,7 +21,7 @@ const substratePidsPending = new Map();
|
||||
rpc.exports = {
|
||||
dispose() {
|
||||
if (suspendedPids.size > 0) {
|
||||
const kill = new NativeFunction(Module.getExportByName(null, 'kill'), 'int', ['int', 'int']);
|
||||
const kill = new NativeFunction(Module.getGlobalExportByName('kill'), 'int', ['int', 'int']);
|
||||
for (const pid of suspendedPids) {
|
||||
kill(pid, SIGKILL);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ rpc.exports = {
|
||||
|
||||
applyJailbreakQuirks();
|
||||
|
||||
Interceptor.attach(Module.getExportByName('/usr/lib/system/libsystem_kernel.dylib', '__posix_spawn'), {
|
||||
Interceptor.attach(Process.getModuleByName('/usr/lib/system/libsystem_kernel.dylib').getExportByName('__posix_spawn'), {
|
||||
onEnter(args) {
|
||||
const env = parseStringv(args[4]);
|
||||
const prewarm = isPrewarmLaunch(env);
|
||||
@@ -238,7 +238,7 @@ function instrumentInserter(at) {
|
||||
}
|
||||
|
||||
function findJbdCallImpl() {
|
||||
const impl = Module.findExportByName(null, 'jbd_call');
|
||||
const impl = Module.findGlobalExportByName('jbd_call');
|
||||
if (impl !== null)
|
||||
return impl;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import ObjC from 'frida-objc-bridge';
|
||||
|
||||
const YES = ptr(1);
|
||||
|
||||
const {
|
||||
@@ -53,7 +55,8 @@ function tryInitialize() {
|
||||
}
|
||||
|
||||
if (!tryInitialize()) {
|
||||
const listener = Interceptor.attach(Module.getExportByName('/usr/lib/system/libsystem_trace.dylib', 'os_log_type_enabled'), () => {
|
||||
const listener = Interceptor.attach(
|
||||
Process.getModuleByName('/usr/lib/system/libsystem_trace.dylib').getExportByName('os_log_type_enabled'), () => {
|
||||
tryInitialize();
|
||||
listener.detach();
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
osanalytics_js = custom_target('osanalytics.js',
|
||||
input: [
|
||||
'package.json',
|
||||
'package-lock.json',
|
||||
'index.js',
|
||||
],
|
||||
output: [
|
||||
'osanalytics.js',
|
||||
],
|
||||
command: [
|
||||
python,
|
||||
compile_js_agent,
|
||||
'@OUTPUT@',
|
||||
'@PRIVATE_DIR@',
|
||||
npm,
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
+553
@@ -0,0 +1,553 @@
|
||||
{
|
||||
"name": "frida-osanalytics-agent",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "frida-osanalytics-agent",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"frida-objc-bridge": "^8.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/frida-gum": "^19.0.0",
|
||||
"frida-compile": "^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/assert": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/assert/-/assert-3.0.2.tgz",
|
||||
"integrity": "sha512-JXJq5SbXGrM5EkjrZKfRmB29zOoEOix02NC6A5TSJ+C1GE/X051EinJJsuOO2pEOx7KZwpvAHvS0WXW0+levKg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/base64-js": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/base64-js/-/base64-js-2.0.3.tgz",
|
||||
"integrity": "sha512-2w0F+1TynOTCZ/v7du9LdHPWwq0lJhazjo2fF9upMyQmA1zHetT14fLuQ1v/6T0qPgyeEGkiSrybstU8EsgeUA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/buffer": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@frida/buffer/-/buffer-7.0.4.tgz",
|
||||
"integrity": "sha512-RxQ1lZRRiCJj7nhcCiD8xeJx0NsLpGGnjqsmTg7jShGmbnVFMN5W7+J+3gqdPSQhc/IxNBIWc6zRXVp4+qnYHg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.5.1",
|
||||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/crosspath": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/crosspath/-/crosspath-3.0.0.tgz",
|
||||
"integrity": "sha512-bNdO1spIPD2P40XtK89N49oZpJhstdlnkJZcD4yJ17jrdkm9Ctu0sd9MIEX6Z8Tm8ydhVJBAOMEKl9/R27onAQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "^17.0.36"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/crypto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@frida/crypto/-/crypto-1.0.1.tgz",
|
||||
"integrity": "sha512-WXTkVjESvX8TIVXIynJJv9BKSIdQP0Iis04StIXknkDi1ULdMlrypA9p5C4KW1H6GCkNsVnKbybpzsulYCTvag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/diagnostics_channel": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/diagnostics_channel/-/diagnostics_channel-1.0.0.tgz",
|
||||
"integrity": "sha512-mYX1jp/5Bpk24tHArJNx65iCk7qSuV8YJkdU0gFNVtJUXxfV8BG5WuPa4mL+ynxsbWWpsg/cwKZbLAepYKTdQQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/events": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@frida/events/-/events-4.0.4.tgz",
|
||||
"integrity": "sha512-qJVQ6VWHf9sjUKuiJzoCAC00frbpcwxeYfvQ+PP9LU/d70j+QvjWgYe98Qa3ekLaBU6r/AvWm8ThKCDUCLWrQQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/http": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/http/-/http-4.0.2.tgz",
|
||||
"integrity": "sha512-cvkc7ex7GmVXVOWqtjXKBWUUbYEBgpNRKZbEEoMeI8KiIs8zejKwg+N7rx7296Ao+EP3+xcUr4wBVr3xLaUVfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"http-parser-js": "^0.5.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/http-parser-js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/http-parser-js/-/http-parser-js-1.0.0.tgz",
|
||||
"integrity": "sha512-2nMrNXt/OeTlWbqnE8AH4Sfz4I2+BGoN206dzKEyC/g2svtn83Xu+zuv/V3TkwrA27s26Mcy84ZwsXeNlqNxUQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/https": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/https/-/https-1.0.0.tgz",
|
||||
"integrity": "sha512-OiqQ6qsALcWOktRLq07oJ0i6sH8eX6MXb/MdZS1qVKDRf6wchH4Pjn6fiLB+pt/OlYbggk+DOfpHwSdjTwuHMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/ieee754": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/ieee754/-/ieee754-2.0.2.tgz",
|
||||
"integrity": "sha512-wlcUebnne4ENN7GDr5pTH598ZDLMVOsh0FjenxeVOe6u7ewZkz9gGRnLnZKJAm9kl5G6XhdxhI0cSXVQK/rQUw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/@frida/net": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/net/-/net-4.0.2.tgz",
|
||||
"integrity": "sha512-qQRe7hQ+ZfCcG/SE3P1TRqQ9bmuK/T7wPCYaT4z56rBPWAxsaQbQHpX4fR6OrFaSDr7X0xJLsTbdIp9hGhhLZg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/os": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/os/-/os-1.0.2.tgz",
|
||||
"integrity": "sha512-3ISAiGNiyIya3QN2EHBCz1wqP0enTdSxP99wUeroeh8+AQRmgoOr/5TRnrVry8pe378anay3fmV/tdUMMSkehQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/path": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/path/-/path-2.0.3.tgz",
|
||||
"integrity": "sha512-2RQy36QatoC846fzBhBhV8sXMsSOBGoYvwTHeaE1zUdz7F4RNScP4QEekTTooBYWYX/XjiF36KQpYAzc9OYFtg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/process": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@frida/process/-/process-1.2.1.tgz",
|
||||
"integrity": "sha512-nvCu22DstFW2ttGFtOKekHM7vnjbZm+XgtvavOt427GNT6uV7k0JYK9tnMbcLMRWv57DG6udAmuJlWs8Paq1ag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/punycode": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/punycode/-/punycode-3.0.0.tgz",
|
||||
"integrity": "sha512-XVSDY2KamDs1D5/fTVgHcOSNxdU4kTboxzqJMBbTjcQC7XScIT9c0EfbwKCq7Kci6gWQdsHSCr7lU+9Oc4KAdg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/querystring": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/querystring/-/querystring-1.0.0.tgz",
|
||||
"integrity": "sha512-15m1fOZPmoO/vWlgPJrG/J9/BJDz6a2/JpVGpS8ynNzo+fBhTznaStX5nHxUs24mVTqh/OqLo0EiYJM5WWHXxg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/readable-stream": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/readable-stream/-/readable-stream-4.1.3.tgz",
|
||||
"integrity": "sha512-ntGUFmi+CryRGRJIK13a/VST2Ad19uivbln8Xd92vKPAARq+6vMIASDyZIqyl5BLRccfiyCHdYgrgQ6RI5rUig==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/reserved-words": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/reserved-words/-/reserved-words-1.0.0.tgz",
|
||||
"integrity": "sha512-2yG/XxJlsGlk/mm6eZTb4OAaQEhkTI2qaFfZFtAsrA/XuCpuMWkS4y/guyBlsRu4hAuhK2HPmNM8+OLLK1zM9Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/stream": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/stream/-/stream-1.0.2.tgz",
|
||||
"integrity": "sha512-4OuaC1ztmEKgTq3WeBhsy8Oq+AwW9n9cYnvLklcC9jwD93AEwgbWpecLlxJCVuALvTMdhKPg0nQVfyGYP/i9Bw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@frida/readable-stream": "^4.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/string_decoder": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/string_decoder/-/string_decoder-2.0.0.tgz",
|
||||
"integrity": "sha512-in371tYZMHQiW9HF5MS3JDw6Ao6tyBoq34UWy2rzOswYyMG1rpizh85ofi/yVkxDiaqybEZefxzkVittpPGT6g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/terser": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/terser/-/terser-1.0.0.tgz",
|
||||
"integrity": "sha512-59h9WuNzD1Rx/zwoWqQ/FW/4Y/Q3R91Eng2hEwdHapqiTDvtKbZ08F6CynCR7ZVinrh4tLYsF46AtVPTz1ys9g==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
"terser": "bin/terser"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/terser/node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/timers": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/timers/-/timers-3.0.0.tgz",
|
||||
"integrity": "sha512-3b+0igv10aT8TMxefrTAd06rActqbxJLY2Xkkq9vYcPBffB/yHszl0NYIp/5ko8WC3ecDYPU6bQiY6fjs72zTA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/tty": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/tty/-/tty-1.0.0.tgz",
|
||||
"integrity": "sha512-p/kjLnKYxEAB1MdYP8+5rKv9CsHzyA+0jg9BcGETzjQVKHHcroHDULRxDYUh+DC7qs6cpX8QdDQh9E+a6ydgsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/url": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/url/-/url-1.0.2.tgz",
|
||||
"integrity": "sha512-ZKunbKJHMr8w2Eb/5K1avy0MzK1B998S17wYXNv3RmzBGxMm8S5T0F3qEpRxkU7/72P8m4izyQU87fWl+FjQsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@frida/punycode": "^3.0.0",
|
||||
"@frida/querystring": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/util": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/util/-/util-1.0.3.tgz",
|
||||
"integrity": "sha512-htcG3uDiRXv89ERVNNYhfase39kJ2X75ZARfrYcYEtJLFEsSk0nemM1YnEIR4CjrHvdvkWHrwgKkS+acOyoNEg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/vm": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/vm/-/vm-2.0.0.tgz",
|
||||
"integrity": "sha512-7fsjLWscZT5odNIBtg6qbLNI+vAk1xmii6H5W2kaYkMYt0vRohQEcDSUWacA+eaWlu5SvMjZI82Yibj/3G9pJw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
|
||||
"integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.2.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
|
||||
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.6",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz",
|
||||
"integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.5",
|
||||
"@jridgewell/trace-mapping": "^0.3.25"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
||||
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.25",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
|
||||
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/frida-gum": {
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-19.0.0.tgz",
|
||||
"integrity": "sha512-qViK1KwvPEAkajwSUv0wpZvZLiX8xO4JFFCh8dfYZfzSyOEfoE0KliCP/nJSKIKG6N3hXnPowrvPufjs5fLKAA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "17.0.45",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
|
||||
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.14.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
|
||||
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/frida-compile": {
|
||||
"version": "17.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-17.0.0.tgz",
|
||||
"integrity": "sha512-ixJRj14qLH/Z0ckFWd5fKeDMm0W2+2WDpSGnLRgpn0nuCQAbDHRCqVCWtPnV8uzPJmA6XOX0pujsMpYe9q9RRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@frida/assert": "^3.0.1",
|
||||
"@frida/base64-js": "^2.0.3",
|
||||
"@frida/buffer": "^7.0.4",
|
||||
"@frida/crosspath": "^3.0.0",
|
||||
"@frida/crypto": "^1.0.1",
|
||||
"@frida/diagnostics_channel": "^1.0.0",
|
||||
"@frida/events": "^4.0.4",
|
||||
"@frida/http": "^4.0.2",
|
||||
"@frida/http-parser-js": "^1.0.0",
|
||||
"@frida/https": "^1.0.0",
|
||||
"@frida/ieee754": "^2.0.2",
|
||||
"@frida/net": "^4.0.1",
|
||||
"@frida/os": "^1.0.0",
|
||||
"@frida/path": "^2.0.3",
|
||||
"@frida/process": "^1.2.1",
|
||||
"@frida/punycode": "^3.0.0",
|
||||
"@frida/querystring": "^1.0.0",
|
||||
"@frida/readable-stream": "^4.1.3",
|
||||
"@frida/reserved-words": "^1.0.0",
|
||||
"@frida/stream": "^1.0.2",
|
||||
"@frida/string_decoder": "^2.0.0",
|
||||
"@frida/terser": "^1.0.0",
|
||||
"@frida/timers": "^3.0.0",
|
||||
"@frida/tty": "^1.0.0",
|
||||
"@frida/url": "^1.0.2",
|
||||
"@frida/util": "^1.0.3",
|
||||
"@frida/vm": "^2.0.0",
|
||||
"commander": "^11.1.0",
|
||||
"frida-fs": "^6.0.0",
|
||||
"typed-emitter": "^2.1.0"
|
||||
},
|
||||
"bin": {
|
||||
"frida-compile": "dist/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/frida-fs": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-6.0.0.tgz",
|
||||
"integrity": "sha512-I0fnKupZh7fU2ixwCIjJnEqNdhfm/SC1ZYBMy58EmeqOWSbjw1Dpy99mJ7BJdbk2KNXJeaBZGxDYLtn0J9S+UA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/frida-objc-bridge": {
|
||||
"version": "8.0.4",
|
||||
"resolved": "https://registry.npmjs.org/frida-objc-bridge/-/frida-objc-bridge-8.0.4.tgz",
|
||||
"integrity": "sha512-AUzwq/+TFtblQLTI97UPX22pBcvyG2oUde9380DXbcJ0zXts4n9JDVONHUr03aBowa0Le+bdBoVdCs7jyyjvlg==",
|
||||
"license": "LGPL-2.0 WITH WxWindows-exception-3.1"
|
||||
},
|
||||
"node_modules/http-parser-js": {
|
||||
"version": "0.5.10",
|
||||
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.10.tgz",
|
||||
"integrity": "sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/rxjs": {
|
||||
"version": "7.8.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"dev": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"rxjs": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "frida-osanalytics-agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Agent used by Frida's Darwin backend on iOS/iPadOS/tvOS",
|
||||
"scripts": {
|
||||
"prepare": "npm run build",
|
||||
"build": "frida-compile index.js -o osanalytics.js -S -c"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/frida-gum": "^19.0.0",
|
||||
"frida-compile": "^17.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"frida-objc-bridge": "^8.0.4"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
const LIBSYSTEM_KERNEL_PATH = '/usr/lib/system/libsystem_kernel.dylib';
|
||||
const CORESYMBOLICATION_PATH = '/System/Library/PrivateFrameworks/CoreSymbolication.framework/CoreSymbolication';
|
||||
const CRASH_REPORTER_SUPPORT_PATH = '/System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport';
|
||||
import ObjC from 'frida-objc-bridge';
|
||||
|
||||
const YES = ptr(1);
|
||||
|
||||
const CSTypeRef = ['pointer', 'pointer'];
|
||||
@@ -17,42 +16,45 @@ const complexFuncOptions = {
|
||||
scheduling: 'cooperative',
|
||||
exceptions: 'propagate'
|
||||
};
|
||||
const libsystemKernel = Process.getModuleByName('/usr/lib/system/libsystem_kernel.dylib');
|
||||
const _pidForTask = new NativeFunction(
|
||||
Module.getExportByName(LIBSYSTEM_KERNEL_PATH, 'pid_for_task'),
|
||||
libsystemKernel.getExportByName('pid_for_task'),
|
||||
'int',
|
||||
['uint', 'pointer'],
|
||||
simpleFuncOptions
|
||||
);
|
||||
const unlink = new NativeFunction(
|
||||
Module.getExportByName(LIBSYSTEM_KERNEL_PATH, 'unlink'),
|
||||
libsystemKernel.getExportByName('unlink'),
|
||||
'int',
|
||||
['pointer'],
|
||||
simpleFuncOptions
|
||||
);
|
||||
const coreSymbolication = Process.getModuleByName('/System/Library/PrivateFrameworks/CoreSymbolication.framework/CoreSymbolication');
|
||||
const CSSymbolicatorGetSymbolWithAddressAtTime = new NativeFunction(
|
||||
Module.getExportByName(CORESYMBOLICATION_PATH, 'CSSymbolicatorGetSymbolWithAddressAtTime'),
|
||||
coreSymbolication.getExportByName('CSSymbolicatorGetSymbolWithAddressAtTime'),
|
||||
CSTypeRef,
|
||||
[CSTypeRef, 'uint64', 'uint64'],
|
||||
complexFuncOptions
|
||||
);
|
||||
const CSIsNull = new NativeFunction(
|
||||
Module.getExportByName(CORESYMBOLICATION_PATH, 'CSIsNull'),
|
||||
coreSymbolication.getExportByName('CSIsNull'),
|
||||
'int',
|
||||
[CSTypeRef],
|
||||
simpleFuncOptions
|
||||
);
|
||||
const mappedMemoryRead = new NativeFunction(
|
||||
Module.getExportByName(CORESYMBOLICATION_PATH, 'mapped_memory_read'),
|
||||
coreSymbolication.getExportByName('mapped_memory_read'),
|
||||
'uint',
|
||||
['pointer', 'uint64', 'uint64', 'pointer'],
|
||||
simpleFuncOptions
|
||||
);
|
||||
const mappedMemoryReadPointer = new NativeFunction(
|
||||
Module.getExportByName(CORESYMBOLICATION_PATH, 'mapped_memory_read_pointer'),
|
||||
coreSymbolication.getExportByName('mapped_memory_read_pointer'),
|
||||
'uint',
|
||||
['pointer', 'uint64', 'pointer'],
|
||||
simpleFuncOptions
|
||||
);
|
||||
const crashReporterSupport = Process.getModuleByName('/System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport');
|
||||
|
||||
const {
|
||||
AppleErrorReport,
|
||||
@@ -67,7 +69,7 @@ const sessions = new Map();
|
||||
let osaHookState = 'pending';
|
||||
|
||||
function initialize() {
|
||||
const listener = Interceptor.attach(Module.getExportByName(CRASH_REPORTER_SUPPORT_PATH, 'CRCreateDirectoryStructure'), () => {
|
||||
const listener = Interceptor.attach(crashReporterSupport.getExportByName('CRCreateDirectoryStructure'), () => {
|
||||
applyInstrumentation();
|
||||
listener.detach();
|
||||
});
|
||||
@@ -144,7 +146,7 @@ function applyInstrumentation() {
|
||||
},
|
||||
});
|
||||
|
||||
Interceptor.attach(Module.getExportByName(CORESYMBOLICATION_PATH, 'task_is_64bit'), {
|
||||
Interceptor.attach(coreSymbolication.getExportByName('task_is_64bit'), {
|
||||
onEnter(args) {
|
||||
this.pid = pidForTask(args[0].toUInt32());
|
||||
},
|
||||
@@ -216,7 +218,7 @@ function applyInstrumentation() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Interceptor.attach(Module.getExportByName(LIBSYSTEM_KERNEL_PATH, 'rename'), {
|
||||
Interceptor.attach(libsystemKernel.getExportByName('rename'), {
|
||||
onEnter(args) {
|
||||
const newPath = args[1].readUtf8String();
|
||||
const session = getSession(this.threadId, 'rename');
|
||||
@@ -225,7 +227,7 @@ function applyInstrumentation() {
|
||||
},
|
||||
});
|
||||
|
||||
Interceptor.attach(Module.getExportByName(LIBSYSTEM_KERNEL_PATH, 'open_dprotected_np'), {
|
||||
Interceptor.attach(libsystemKernel.getExportByName('open_dprotected_np'), {
|
||||
onEnter(args) {
|
||||
const path = args[0].readUtf8String();
|
||||
this.isCrashLog = /\.ips$/.test(path);
|
||||
@@ -237,7 +239,7 @@ function applyInstrumentation() {
|
||||
},
|
||||
});
|
||||
|
||||
Interceptor.attach(Module.getExportByName(LIBSYSTEM_KERNEL_PATH, 'write'), {
|
||||
Interceptor.attach(libsystemKernel.getExportByName('write'), {
|
||||
onEnter(args) {
|
||||
const fd = args[0].toInt32();
|
||||
this.buf = args[1];
|
||||
@@ -266,7 +268,7 @@ function applyInstrumentation() {
|
||||
});
|
||||
}
|
||||
|
||||
Interceptor.attach(Module.getExportByName(CRASH_REPORTER_SUPPORT_PATH, 'OSAPreferencesGetBoolValue'), {
|
||||
Interceptor.attach(crashReporterSupport.getExportByName('OSAPreferencesGetBoolValue'), {
|
||||
onEnter(args) {
|
||||
this.name = new ObjC.Object(args[0]).toString();
|
||||
this.domain = new ObjC.Object(args[1]).toString();
|
||||
@@ -0,0 +1,18 @@
|
||||
reportcrash_js = custom_target('reportcrash.js',
|
||||
input: [
|
||||
'package.json',
|
||||
'package-lock.json',
|
||||
'index.js',
|
||||
],
|
||||
output: [
|
||||
'reportcrash.js',
|
||||
],
|
||||
command: [
|
||||
python,
|
||||
compile_js_agent,
|
||||
'@OUTPUT@',
|
||||
'@PRIVATE_DIR@',
|
||||
npm,
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
+553
@@ -0,0 +1,553 @@
|
||||
{
|
||||
"name": "frida-reportcrash-agent",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "frida-reportcrash-agent",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"frida-objc-bridge": "^8.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/frida-gum": "^19.0.0",
|
||||
"frida-compile": "^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/assert": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/assert/-/assert-3.0.2.tgz",
|
||||
"integrity": "sha512-JXJq5SbXGrM5EkjrZKfRmB29zOoEOix02NC6A5TSJ+C1GE/X051EinJJsuOO2pEOx7KZwpvAHvS0WXW0+levKg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/base64-js": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/base64-js/-/base64-js-2.0.3.tgz",
|
||||
"integrity": "sha512-2w0F+1TynOTCZ/v7du9LdHPWwq0lJhazjo2fF9upMyQmA1zHetT14fLuQ1v/6T0qPgyeEGkiSrybstU8EsgeUA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/buffer": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@frida/buffer/-/buffer-7.0.4.tgz",
|
||||
"integrity": "sha512-RxQ1lZRRiCJj7nhcCiD8xeJx0NsLpGGnjqsmTg7jShGmbnVFMN5W7+J+3gqdPSQhc/IxNBIWc6zRXVp4+qnYHg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.5.1",
|
||||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/crosspath": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/crosspath/-/crosspath-3.0.0.tgz",
|
||||
"integrity": "sha512-bNdO1spIPD2P40XtK89N49oZpJhstdlnkJZcD4yJ17jrdkm9Ctu0sd9MIEX6Z8Tm8ydhVJBAOMEKl9/R27onAQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "^17.0.36"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/crypto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@frida/crypto/-/crypto-1.0.1.tgz",
|
||||
"integrity": "sha512-WXTkVjESvX8TIVXIynJJv9BKSIdQP0Iis04StIXknkDi1ULdMlrypA9p5C4KW1H6GCkNsVnKbybpzsulYCTvag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/diagnostics_channel": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/diagnostics_channel/-/diagnostics_channel-1.0.0.tgz",
|
||||
"integrity": "sha512-mYX1jp/5Bpk24tHArJNx65iCk7qSuV8YJkdU0gFNVtJUXxfV8BG5WuPa4mL+ynxsbWWpsg/cwKZbLAepYKTdQQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/events": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@frida/events/-/events-4.0.4.tgz",
|
||||
"integrity": "sha512-qJVQ6VWHf9sjUKuiJzoCAC00frbpcwxeYfvQ+PP9LU/d70j+QvjWgYe98Qa3ekLaBU6r/AvWm8ThKCDUCLWrQQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/http": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/http/-/http-4.0.2.tgz",
|
||||
"integrity": "sha512-cvkc7ex7GmVXVOWqtjXKBWUUbYEBgpNRKZbEEoMeI8KiIs8zejKwg+N7rx7296Ao+EP3+xcUr4wBVr3xLaUVfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"http-parser-js": "^0.5.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/http-parser-js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/http-parser-js/-/http-parser-js-1.0.0.tgz",
|
||||
"integrity": "sha512-2nMrNXt/OeTlWbqnE8AH4Sfz4I2+BGoN206dzKEyC/g2svtn83Xu+zuv/V3TkwrA27s26Mcy84ZwsXeNlqNxUQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/https": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/https/-/https-1.0.0.tgz",
|
||||
"integrity": "sha512-OiqQ6qsALcWOktRLq07oJ0i6sH8eX6MXb/MdZS1qVKDRf6wchH4Pjn6fiLB+pt/OlYbggk+DOfpHwSdjTwuHMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/ieee754": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/ieee754/-/ieee754-2.0.2.tgz",
|
||||
"integrity": "sha512-wlcUebnne4ENN7GDr5pTH598ZDLMVOsh0FjenxeVOe6u7ewZkz9gGRnLnZKJAm9kl5G6XhdxhI0cSXVQK/rQUw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/@frida/net": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/net/-/net-4.0.2.tgz",
|
||||
"integrity": "sha512-qQRe7hQ+ZfCcG/SE3P1TRqQ9bmuK/T7wPCYaT4z56rBPWAxsaQbQHpX4fR6OrFaSDr7X0xJLsTbdIp9hGhhLZg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/os": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/os/-/os-1.0.2.tgz",
|
||||
"integrity": "sha512-3ISAiGNiyIya3QN2EHBCz1wqP0enTdSxP99wUeroeh8+AQRmgoOr/5TRnrVry8pe378anay3fmV/tdUMMSkehQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/path": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/path/-/path-2.0.3.tgz",
|
||||
"integrity": "sha512-2RQy36QatoC846fzBhBhV8sXMsSOBGoYvwTHeaE1zUdz7F4RNScP4QEekTTooBYWYX/XjiF36KQpYAzc9OYFtg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/process": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@frida/process/-/process-1.2.1.tgz",
|
||||
"integrity": "sha512-nvCu22DstFW2ttGFtOKekHM7vnjbZm+XgtvavOt427GNT6uV7k0JYK9tnMbcLMRWv57DG6udAmuJlWs8Paq1ag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/punycode": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/punycode/-/punycode-3.0.0.tgz",
|
||||
"integrity": "sha512-XVSDY2KamDs1D5/fTVgHcOSNxdU4kTboxzqJMBbTjcQC7XScIT9c0EfbwKCq7Kci6gWQdsHSCr7lU+9Oc4KAdg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/querystring": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/querystring/-/querystring-1.0.0.tgz",
|
||||
"integrity": "sha512-15m1fOZPmoO/vWlgPJrG/J9/BJDz6a2/JpVGpS8ynNzo+fBhTznaStX5nHxUs24mVTqh/OqLo0EiYJM5WWHXxg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/readable-stream": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/readable-stream/-/readable-stream-4.1.3.tgz",
|
||||
"integrity": "sha512-ntGUFmi+CryRGRJIK13a/VST2Ad19uivbln8Xd92vKPAARq+6vMIASDyZIqyl5BLRccfiyCHdYgrgQ6RI5rUig==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/reserved-words": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/reserved-words/-/reserved-words-1.0.0.tgz",
|
||||
"integrity": "sha512-2yG/XxJlsGlk/mm6eZTb4OAaQEhkTI2qaFfZFtAsrA/XuCpuMWkS4y/guyBlsRu4hAuhK2HPmNM8+OLLK1zM9Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/stream": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/stream/-/stream-1.0.2.tgz",
|
||||
"integrity": "sha512-4OuaC1ztmEKgTq3WeBhsy8Oq+AwW9n9cYnvLklcC9jwD93AEwgbWpecLlxJCVuALvTMdhKPg0nQVfyGYP/i9Bw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@frida/readable-stream": "^4.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/string_decoder": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/string_decoder/-/string_decoder-2.0.0.tgz",
|
||||
"integrity": "sha512-in371tYZMHQiW9HF5MS3JDw6Ao6tyBoq34UWy2rzOswYyMG1rpizh85ofi/yVkxDiaqybEZefxzkVittpPGT6g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/terser": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/terser/-/terser-1.0.0.tgz",
|
||||
"integrity": "sha512-59h9WuNzD1Rx/zwoWqQ/FW/4Y/Q3R91Eng2hEwdHapqiTDvtKbZ08F6CynCR7ZVinrh4tLYsF46AtVPTz1ys9g==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
"commander": "^2.20.0",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
"terser": "bin/terser"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/terser/node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/timers": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/timers/-/timers-3.0.0.tgz",
|
||||
"integrity": "sha512-3b+0igv10aT8TMxefrTAd06rActqbxJLY2Xkkq9vYcPBffB/yHszl0NYIp/5ko8WC3ecDYPU6bQiY6fjs72zTA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/tty": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/tty/-/tty-1.0.0.tgz",
|
||||
"integrity": "sha512-p/kjLnKYxEAB1MdYP8+5rKv9CsHzyA+0jg9BcGETzjQVKHHcroHDULRxDYUh+DC7qs6cpX8QdDQh9E+a6ydgsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/url": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@frida/url/-/url-1.0.2.tgz",
|
||||
"integrity": "sha512-ZKunbKJHMr8w2Eb/5K1avy0MzK1B998S17wYXNv3RmzBGxMm8S5T0F3qEpRxkU7/72P8m4izyQU87fWl+FjQsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@frida/punycode": "^3.0.0",
|
||||
"@frida/querystring": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@frida/util": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@frida/util/-/util-1.0.3.tgz",
|
||||
"integrity": "sha512-htcG3uDiRXv89ERVNNYhfase39kJ2X75ZARfrYcYEtJLFEsSk0nemM1YnEIR4CjrHvdvkWHrwgKkS+acOyoNEg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@frida/vm": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@frida/vm/-/vm-2.0.0.tgz",
|
||||
"integrity": "sha512-7fsjLWscZT5odNIBtg6qbLNI+vAk1xmii6H5W2kaYkMYt0vRohQEcDSUWacA+eaWlu5SvMjZI82Yibj/3G9pJw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
|
||||
"integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.2.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
|
||||
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.6",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz",
|
||||
"integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.5",
|
||||
"@jridgewell/trace-mapping": "^0.3.25"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
||||
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.25",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
|
||||
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/frida-gum": {
|
||||
"version": "19.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/frida-gum/-/frida-gum-19.0.0.tgz",
|
||||
"integrity": "sha512-qViK1KwvPEAkajwSUv0wpZvZLiX8xO4JFFCh8dfYZfzSyOEfoE0KliCP/nJSKIKG6N3hXnPowrvPufjs5fLKAA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "17.0.45",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
|
||||
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.14.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
|
||||
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/frida-compile": {
|
||||
"version": "17.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-compile/-/frida-compile-17.0.0.tgz",
|
||||
"integrity": "sha512-ixJRj14qLH/Z0ckFWd5fKeDMm0W2+2WDpSGnLRgpn0nuCQAbDHRCqVCWtPnV8uzPJmA6XOX0pujsMpYe9q9RRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@frida/assert": "^3.0.1",
|
||||
"@frida/base64-js": "^2.0.3",
|
||||
"@frida/buffer": "^7.0.4",
|
||||
"@frida/crosspath": "^3.0.0",
|
||||
"@frida/crypto": "^1.0.1",
|
||||
"@frida/diagnostics_channel": "^1.0.0",
|
||||
"@frida/events": "^4.0.4",
|
||||
"@frida/http": "^4.0.2",
|
||||
"@frida/http-parser-js": "^1.0.0",
|
||||
"@frida/https": "^1.0.0",
|
||||
"@frida/ieee754": "^2.0.2",
|
||||
"@frida/net": "^4.0.1",
|
||||
"@frida/os": "^1.0.0",
|
||||
"@frida/path": "^2.0.3",
|
||||
"@frida/process": "^1.2.1",
|
||||
"@frida/punycode": "^3.0.0",
|
||||
"@frida/querystring": "^1.0.0",
|
||||
"@frida/readable-stream": "^4.1.3",
|
||||
"@frida/reserved-words": "^1.0.0",
|
||||
"@frida/stream": "^1.0.2",
|
||||
"@frida/string_decoder": "^2.0.0",
|
||||
"@frida/terser": "^1.0.0",
|
||||
"@frida/timers": "^3.0.0",
|
||||
"@frida/tty": "^1.0.0",
|
||||
"@frida/url": "^1.0.2",
|
||||
"@frida/util": "^1.0.3",
|
||||
"@frida/vm": "^2.0.0",
|
||||
"commander": "^11.1.0",
|
||||
"frida-fs": "^6.0.0",
|
||||
"typed-emitter": "^2.1.0"
|
||||
},
|
||||
"bin": {
|
||||
"frida-compile": "dist/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/frida-fs": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/frida-fs/-/frida-fs-6.0.0.tgz",
|
||||
"integrity": "sha512-I0fnKupZh7fU2ixwCIjJnEqNdhfm/SC1ZYBMy58EmeqOWSbjw1Dpy99mJ7BJdbk2KNXJeaBZGxDYLtn0J9S+UA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/frida-objc-bridge": {
|
||||
"version": "8.0.4",
|
||||
"resolved": "https://registry.npmjs.org/frida-objc-bridge/-/frida-objc-bridge-8.0.4.tgz",
|
||||
"integrity": "sha512-AUzwq/+TFtblQLTI97UPX22pBcvyG2oUde9380DXbcJ0zXts4n9JDVONHUr03aBowa0Le+bdBoVdCs7jyyjvlg==",
|
||||
"license": "LGPL-2.0 WITH WxWindows-exception-3.1"
|
||||
},
|
||||
"node_modules/http-parser-js": {
|
||||
"version": "0.5.10",
|
||||
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.10.tgz",
|
||||
"integrity": "sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/rxjs": {
|
||||
"version": "7.8.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"dev": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/typed-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"rxjs": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "frida-reportcrash-agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Agent used by Frida's Darwin backend on iOS/iPadOS/tvOS",
|
||||
"scripts": {
|
||||
"prepare": "npm run build",
|
||||
"build": "frida-compile index.js -o reportcrash.js -S -c"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/frida-gum": "^19.0.0",
|
||||
"frida-compile": "^17.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"frida-objc-bridge": "^8.0.4"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ const POSIX_SPAWN_START_SUSPENDED = 0x0080;
|
||||
|
||||
applyJailbreakQuirks();
|
||||
|
||||
Interceptor.attach(Module.getExportByName('/usr/lib/system/libsystem_kernel.dylib', '__posix_spawn'), {
|
||||
Interceptor.attach(Process.getModuleByName('/usr/lib/system/libsystem_kernel.dylib').getExportByName('__posix_spawn'), {
|
||||
onEnter(args) {
|
||||
const attrs = args[2].add(Process.pointerSize).readPointer();
|
||||
|
||||
@@ -42,7 +42,7 @@ function sabotageJbdCall(jbdCallImpl) {
|
||||
}
|
||||
|
||||
function instrumentSubstrateBootstrapper(bootstrapper) {
|
||||
Interceptor.attach(Module.getExportByName('/usr/lib/system/libdyld.dylib', 'dlopen'), {
|
||||
Interceptor.attach(Process.getModuleByName('/usr/lib/system/libdyld.dylib').getExportByName('dlopen'), {
|
||||
onEnter(args) {
|
||||
this.path = args[0].readUtf8String();
|
||||
},
|
||||
@@ -66,7 +66,7 @@ function instrumentSubstrateExec(exec) {
|
||||
}
|
||||
|
||||
function findJbdCallImpl() {
|
||||
const impl = Module.findExportByName(null, 'jbd_call');
|
||||
const impl = Module.findGlobalExportByName('jbd_call');
|
||||
if (impl !== null)
|
||||
return impl;
|
||||
|
||||
|
||||
@@ -1,98 +1,24 @@
|
||||
namespace Frida {
|
||||
public class DarwinHostSessionBackend : Object, HostSessionBackend {
|
||||
private DarwinHostSessionProvider local_provider;
|
||||
|
||||
public async void start (Cancellable? cancellable) throws IOError {
|
||||
assert (local_provider == null);
|
||||
local_provider = new DarwinHostSessionProvider ();
|
||||
provider_available (local_provider);
|
||||
}
|
||||
|
||||
public async void stop (Cancellable? cancellable) throws IOError {
|
||||
assert (local_provider != null);
|
||||
provider_unavailable (local_provider);
|
||||
yield local_provider.close (cancellable);
|
||||
local_provider = null;
|
||||
public sealed class DarwinHostSessionBackend : LocalHostSessionBackend {
|
||||
protected override LocalHostSessionProvider make_provider () {
|
||||
return new DarwinHostSessionProvider ();
|
||||
}
|
||||
}
|
||||
|
||||
public class DarwinHostSessionProvider : Object, HostSessionProvider {
|
||||
public string id {
|
||||
get { return "local"; }
|
||||
}
|
||||
|
||||
public string name {
|
||||
get { return "Local System"; }
|
||||
}
|
||||
|
||||
public Variant? icon {
|
||||
get { return _icon; }
|
||||
}
|
||||
private Variant? _icon;
|
||||
|
||||
public HostSessionProviderKind kind {
|
||||
get { return HostSessionProviderKind.LOCAL; }
|
||||
}
|
||||
|
||||
private DarwinHostSession host_session;
|
||||
|
||||
construct {
|
||||
_icon = _try_extract_icon ();
|
||||
}
|
||||
|
||||
public async void close (Cancellable? cancellable) throws IOError {
|
||||
if (host_session == null)
|
||||
return;
|
||||
host_session.agent_session_detached.disconnect (on_agent_session_detached);
|
||||
yield host_session.close (cancellable);
|
||||
host_session = null;
|
||||
}
|
||||
|
||||
public async HostSession create (HostSessionOptions? options, Cancellable? cancellable) throws Error, IOError {
|
||||
if (host_session != null)
|
||||
throw new Error.INVALID_OPERATION ("Already created");
|
||||
|
||||
public sealed class DarwinHostSessionProvider : LocalHostSessionProvider {
|
||||
protected override LocalHostSession make_host_session (HostSessionOptions? options) throws Error {
|
||||
var tempdir = new TemporaryDirectory ();
|
||||
|
||||
host_session = new DarwinHostSession (new DarwinHelperProcess (tempdir), tempdir);
|
||||
host_session.agent_session_detached.connect (on_agent_session_detached);
|
||||
|
||||
return host_session;
|
||||
return new DarwinHostSession (new DarwinHelperProcess (tempdir), tempdir);
|
||||
}
|
||||
|
||||
public async void destroy (HostSession session, Cancellable? cancellable) throws Error, IOError {
|
||||
if (session != host_session)
|
||||
throw new Error.INVALID_ARGUMENT ("Invalid host session");
|
||||
|
||||
host_session.agent_session_detached.disconnect (on_agent_session_detached);
|
||||
|
||||
yield host_session.close (cancellable);
|
||||
host_session = null;
|
||||
}
|
||||
|
||||
public async AgentSession link_agent_session (HostSession host_session, AgentSessionId id, AgentMessageSink sink,
|
||||
Cancellable? cancellable) throws Error, IOError {
|
||||
if (host_session != this.host_session)
|
||||
throw new Error.INVALID_ARGUMENT ("Invalid host session");
|
||||
|
||||
return yield this.host_session.link_agent_session (id, sink, cancellable);
|
||||
}
|
||||
|
||||
public void unlink_agent_session (HostSession host_session, AgentSessionId id) {
|
||||
if (host_session != this.host_session)
|
||||
return;
|
||||
|
||||
this.host_session.unlink_agent_session (id);
|
||||
}
|
||||
|
||||
private void on_agent_session_detached (AgentSessionId id, SessionDetachReason reason, CrashInfo crash) {
|
||||
agent_session_detached (id, reason, crash);
|
||||
protected override Variant? load_icon () {
|
||||
return _try_extract_icon ();
|
||||
}
|
||||
|
||||
public extern static Variant? _try_extract_icon ();
|
||||
}
|
||||
|
||||
public class DarwinHostSession : BaseDBusHostSession {
|
||||
public sealed class DarwinHostSession : LocalHostSession {
|
||||
public DarwinHelper helper {
|
||||
get;
|
||||
construct;
|
||||
@@ -410,7 +336,7 @@ namespace Frida {
|
||||
}
|
||||
|
||||
#if IOS || TVOS
|
||||
private class FruitController : Object, MappedAgentContainer {
|
||||
private sealed class FruitController : Object, MappedAgentContainer {
|
||||
public signal void spawn_added (HostSpawnInfo info);
|
||||
public signal void spawn_removed (HostSpawnInfo info);
|
||||
public signal void process_crashed (CrashInfo crash);
|
||||
@@ -815,7 +741,7 @@ namespace Frida {
|
||||
crash_deliveries.unset (delivery.pid);
|
||||
}
|
||||
|
||||
private class CrashDelivery : Object {
|
||||
private sealed class CrashDelivery : Object {
|
||||
public signal void expired ();
|
||||
|
||||
public uint pid {
|
||||
@@ -882,7 +808,7 @@ namespace Frida {
|
||||
|
||||
private delegate void FoundMappedAgentFunc (MappedAgent agent);
|
||||
|
||||
private class MappedAgent {
|
||||
private sealed class MappedAgent {
|
||||
public uint id {
|
||||
get;
|
||||
private set;
|
||||
@@ -905,7 +831,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class LaunchdAgent : InternalAgent {
|
||||
private sealed class LaunchdAgent : InternalAgent {
|
||||
public signal void app_launch_started (string identifier, uint pid);
|
||||
public signal void app_launch_completed (string identifier, uint pid, GLib.Error? error);
|
||||
public signal void spawn_preparation_started (HostSpawnInfo info);
|
||||
@@ -933,27 +859,28 @@ namespace Frida {
|
||||
}
|
||||
|
||||
public async void prepare_for_launch (string identifier, Cancellable? cancellable) throws Error, IOError {
|
||||
yield call ("prepareForLaunch", new Json.Node[] { new Json.Node.alloc ().init_string (identifier) }, cancellable);
|
||||
yield call ("prepareForLaunch", new Json.Node[] { new Json.Node.alloc ().init_string (identifier) }, null,
|
||||
cancellable);
|
||||
}
|
||||
|
||||
public async void cancel_launch (string identifier, Cancellable? cancellable) throws Error, IOError {
|
||||
yield call ("cancelLaunch", new Json.Node[] { new Json.Node.alloc ().init_string (identifier) }, cancellable);
|
||||
yield call ("cancelLaunch", new Json.Node[] { new Json.Node.alloc ().init_string (identifier) }, null, cancellable);
|
||||
}
|
||||
|
||||
public async void enable_spawn_gating (Cancellable? cancellable) throws Error, IOError {
|
||||
yield call ("enableSpawnGating", new Json.Node[] {}, cancellable);
|
||||
yield call ("enableSpawnGating", new Json.Node[] {}, null, cancellable);
|
||||
}
|
||||
|
||||
public async void disable_spawn_gating (Cancellable? cancellable) throws Error, IOError {
|
||||
yield call ("disableSpawnGating", new Json.Node[] {}, cancellable);
|
||||
yield call ("disableSpawnGating", new Json.Node[] {}, null, cancellable);
|
||||
}
|
||||
|
||||
public async void claim_process (uint pid, Cancellable? cancellable) throws Error, IOError {
|
||||
yield call ("claimProcess", new Json.Node[] { new Json.Node.alloc ().init_int (pid) }, cancellable);
|
||||
yield call ("claimProcess", new Json.Node[] { new Json.Node.alloc ().init_int (pid) }, null, cancellable);
|
||||
}
|
||||
|
||||
public async void unclaim_process (uint pid, Cancellable? cancellable) throws Error, IOError {
|
||||
yield call ("unclaimProcess", new Json.Node[] { new Json.Node.alloc ().init_int (pid) }, cancellable);
|
||||
yield call ("unclaimProcess", new Json.Node[] { new Json.Node.alloc ().init_int (pid) }, null, cancellable);
|
||||
}
|
||||
|
||||
protected override void on_event (string type, Json.Array event) {
|
||||
@@ -1014,7 +941,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class XpcProxyAgent : InternalAgent {
|
||||
private sealed class XpcProxyAgent : InternalAgent {
|
||||
public string identifier {
|
||||
get;
|
||||
construct;
|
||||
@@ -1056,7 +983,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class ReportCrashAgent : InternalAgent {
|
||||
private sealed class ReportCrashAgent : InternalAgent {
|
||||
public signal void crash_detected (uint pid);
|
||||
public signal void crash_received (CrashInfo crash);
|
||||
|
||||
@@ -1288,7 +1215,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class OSAnalyticsAgent : InternalAgent {
|
||||
private sealed class OSAnalyticsAgent : InternalAgent {
|
||||
public uint pid {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
# define CORE_FOUNDATION "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
|
||||
#endif
|
||||
|
||||
typedef struct _FridaHelperContext FridaHelperContext;
|
||||
typedef struct _FridaDispatchContext FridaDispatchContext;
|
||||
typedef struct _FridaSpawnInstance FridaSpawnInstance;
|
||||
typedef guint FridaDyldFlavor;
|
||||
typedef struct _FridaSpawnInstanceDyldData FridaSpawnInstanceDyldData;
|
||||
@@ -106,7 +106,7 @@ typedef union _FridaDebugState FridaDebugState;
|
||||
typedef int FridaConvertThreadStateDirection;
|
||||
typedef guint FridaAslr;
|
||||
|
||||
struct _FridaHelperContext
|
||||
struct _FridaDispatchContext
|
||||
{
|
||||
dispatch_queue_t dispatch_queue;
|
||||
};
|
||||
@@ -183,6 +183,7 @@ struct _FridaSpawnInstance
|
||||
GumAddress modern_entry_address;
|
||||
|
||||
/* V4+ */
|
||||
GumAddress notify_objc_init;
|
||||
GumAddress info_ptr_address;
|
||||
|
||||
/* V3- */
|
||||
@@ -375,7 +376,7 @@ enum _FridaAslr
|
||||
};
|
||||
|
||||
static FridaSpawnInstance * frida_spawn_instance_new (FridaDarwinHelperBackend * backend);
|
||||
static void frida_spawn_instance_free (FridaSpawnInstance * instance);
|
||||
static void frida_spawn_instance_close (FridaSpawnInstance * instance);
|
||||
static void frida_spawn_instance_resume (FridaSpawnInstance * self);
|
||||
|
||||
static void frida_spawn_instance_on_server_cancel (void * context);
|
||||
@@ -390,12 +391,12 @@ static void frida_spawn_instance_set_libc_initialized (FridaSpawnInstance * self
|
||||
static kern_return_t frida_spawn_instance_create_dyld_data (FridaSpawnInstance * self);
|
||||
static void frida_spawn_instance_destroy_dyld_data (FridaSpawnInstance * self);
|
||||
#if defined (HAVE_IOS) || defined (HAVE_TVOS)
|
||||
static gboolean frida_pick_ios_tvos_bootstrapper (const GumModuleDetails * details, gpointer user_data);
|
||||
static gboolean frida_pick_ios_tvos_bootstrapper (GumModule * module, gpointer user_data);
|
||||
#endif
|
||||
static void frida_spawn_instance_unset_helpers (FridaSpawnInstance * self);
|
||||
static void frida_spawn_instance_call_set_helpers (FridaSpawnInstance * self, GumDarwinUnifiedThreadState * state, mach_vm_address_t helpers);
|
||||
static void frida_spawn_instance_call_dlopen (FridaSpawnInstance * self, GumDarwinUnifiedThreadState * state, mach_vm_address_t lib_name, int mode);
|
||||
static gboolean frida_find_cf_initialize (const GumModuleDetails * details, gpointer user_data);
|
||||
static gboolean frida_find_cf_initialize (GumModule * module, gpointer user_data);
|
||||
static void frida_spawn_instance_call_cf_initialize (FridaSpawnInstance * self, GumDarwinUnifiedThreadState * state);
|
||||
static void frida_spawn_instance_set_nth_breakpoint (FridaSpawnInstance * self, guint n, GumAddress break_at, FridaBreakpointRepeat repeat);
|
||||
static void frida_spawn_instance_enable_nth_breakpoint (FridaSpawnInstance * self, guint n);
|
||||
@@ -409,7 +410,7 @@ static void frida_configure_terminal_attributes (gint fd);
|
||||
|
||||
static FridaInjectInstance * frida_inject_instance_new (FridaDarwinHelperBackend * backend, guint id, guint pid);
|
||||
static FridaInjectInstance * frida_inject_instance_clone (const FridaInjectInstance * instance, guint id);
|
||||
static void frida_inject_instance_free (FridaInjectInstance * instance);
|
||||
static void frida_inject_instance_close (FridaInjectInstance * instance);
|
||||
static gboolean frida_inject_instance_task_did_not_exec (FridaInjectInstance * instance);
|
||||
|
||||
static gboolean frida_inject_instance_start_thread (FridaInjectInstance * self, GError ** error);
|
||||
@@ -428,6 +429,8 @@ static void frida_agent_context_emit_mach_stub_code (FridaAgentContext * self, g
|
||||
static void frida_agent_context_emit_pthread_stub_code (FridaAgentContext * self, guint8 * code, GumDarwinModuleResolver * resolver,
|
||||
GumDarwinMapper * mapper);
|
||||
|
||||
static gboolean frida_convert_thread_state_for_task (mach_port_t task, thread_state_flavor_t flavor, gconstpointer in_state,
|
||||
mach_msg_type_number_t in_state_count, gpointer out_state, mach_msg_type_number_t * out_state_count, GError ** error);
|
||||
static mach_port_t frida_obtain_thread_port_for_thread_id (mach_port_t task, uint64_t thread_id);
|
||||
static kern_return_t frida_get_thread_state (mach_port_t thread, thread_state_flavor_t flavor, gpointer state,
|
||||
mach_msg_type_number_t * count);
|
||||
@@ -759,30 +762,30 @@ permission_denied:
|
||||
}
|
||||
|
||||
void
|
||||
_frida_darwin_helper_backend_create_context (FridaDarwinHelperBackend * self)
|
||||
_frida_darwin_helper_backend_create_dispatch_context (FridaDarwinHelperBackend * self)
|
||||
{
|
||||
FridaHelperContext * ctx;
|
||||
FridaDispatchContext * ctx;
|
||||
|
||||
ctx = g_slice_new (FridaHelperContext);
|
||||
ctx = g_slice_new (FridaDispatchContext);
|
||||
ctx->dispatch_queue = dispatch_queue_create ("re.frida.helper.queue", DISPATCH_QUEUE_SERIAL);
|
||||
|
||||
self->context = ctx;
|
||||
self->dispatch_context = ctx;
|
||||
}
|
||||
|
||||
void
|
||||
_frida_darwin_helper_backend_destroy_context (FridaDarwinHelperBackend * self)
|
||||
_frida_darwin_helper_backend_destroy_dispatch_context (FridaDarwinHelperBackend * self)
|
||||
{
|
||||
FridaHelperContext * ctx = self->context;
|
||||
FridaDispatchContext * ctx = self->dispatch_context;
|
||||
|
||||
dispatch_release (ctx->dispatch_queue);
|
||||
|
||||
g_slice_free (FridaHelperContext, ctx);
|
||||
g_slice_free (FridaDispatchContext, ctx);
|
||||
}
|
||||
|
||||
void
|
||||
_frida_darwin_helper_backend_schedule_on_dispatch_queue (FridaDarwinHelperBackend * self, FridaDarwinHelperBackendDispatchWorker worker, gpointer user_data)
|
||||
{
|
||||
FridaHelperContext * ctx = self->context;
|
||||
FridaDispatchContext * ctx = self->dispatch_context;
|
||||
|
||||
dispatch_async (ctx->dispatch_queue, ^
|
||||
{
|
||||
@@ -931,7 +934,7 @@ any_failure:
|
||||
{
|
||||
if (instance->pid != 0)
|
||||
kill (instance->pid, SIGKILL);
|
||||
frida_spawn_instance_free (instance);
|
||||
frida_spawn_instance_close (instance);
|
||||
|
||||
pid = 0;
|
||||
|
||||
@@ -1866,7 +1869,7 @@ void
|
||||
_frida_darwin_helper_backend_prepare_spawn_instance_for_injection (FridaDarwinHelperBackend * self, void * opaque_instance, guint task, GError ** error)
|
||||
{
|
||||
FridaSpawnInstance * instance = opaque_instance;
|
||||
FridaHelperContext * ctx = self->context;
|
||||
FridaDispatchContext * ctx = self->dispatch_context;
|
||||
const gchar * failed_operation;
|
||||
kern_return_t kr;
|
||||
mach_port_t self_task, child_thread;
|
||||
@@ -2024,10 +2027,16 @@ _frida_darwin_helper_backend_prepare_spawn_instance_for_injection (FridaDarwinHe
|
||||
}
|
||||
}
|
||||
|
||||
modern_entry_address = gum_darwin_module_resolve_symbol_address (dyld, "__ZN5dyld44APIs19_libdyld_initializeEPKNS_16LibSystemHelpersE");
|
||||
modern_entry_address = gum_darwin_module_resolve_symbol_address (dyld, "__ZN5dyld44APIs19_libdyld_initializeEv");
|
||||
if (modern_entry_address == 0)
|
||||
modern_entry_address = gum_darwin_module_resolve_symbol_address (dyld, "__ZN5dyld44APIs19_libdyld_initializeEPKNS_16LibSystemHelpersE");
|
||||
instance->dyld_flavor = (modern_entry_address != 0) ? FRIDA_DYLD_V4_PLUS : FRIDA_DYLD_V3_MINUS;
|
||||
if (instance->dyld_flavor == FRIDA_DYLD_V4_PLUS)
|
||||
{
|
||||
instance->notify_objc_init = gum_darwin_module_resolve_symbol_address (dyld, "__ZN5dyld412RuntimeState14notifyObjCInitEPKNS_6LoaderE");
|
||||
if (instance->notify_objc_init != 0)
|
||||
modern_entry_address = instance->notify_objc_init;
|
||||
|
||||
instance->modern_entry_address = modern_entry_address;
|
||||
legacy_entry_address = 0;
|
||||
|
||||
@@ -2106,7 +2115,17 @@ _frida_darwin_helper_backend_prepare_spawn_instance_for_injection (FridaDarwinHe
|
||||
if (instance->dyld_flavor == FRIDA_DYLD_V4_PLUS)
|
||||
{
|
||||
GumAddress restart_with_dyld_in_cache = gum_darwin_module_resolve_symbol_address (dyld,
|
||||
"__ZN5dyld422restartWithDyldInCacheEPKNS_10KernelArgsEPKN6mach_o6HeaderEPK15DyldSharedCachePv");
|
||||
if (restart_with_dyld_in_cache == 0)
|
||||
{
|
||||
restart_with_dyld_in_cache = gum_darwin_module_resolve_symbol_address (dyld,
|
||||
"__ZN5dyld422restartWithDyldInCacheEPKNS_10KernelArgsEPKN5dyld39MachOFileEPK15DyldSharedCachePv");
|
||||
}
|
||||
if (restart_with_dyld_in_cache == 0)
|
||||
{
|
||||
restart_with_dyld_in_cache = gum_darwin_module_resolve_symbol_address (dyld,
|
||||
"__ZN5dyld422restartWithDyldInCacheEPKNS_10KernelArgsEPKN5dyld39MachOFileEPv");
|
||||
}
|
||||
if (restart_with_dyld_in_cache != 0)
|
||||
frida_spawn_instance_set_nth_breakpoint (instance, i++, restart_with_dyld_in_cache, FRIDA_BREAKPOINT_REPEAT_NEVER);
|
||||
}
|
||||
@@ -2188,9 +2207,9 @@ _frida_darwin_helper_backend_resume_spawn_instance (FridaDarwinHelperBackend * s
|
||||
}
|
||||
|
||||
void
|
||||
_frida_darwin_helper_backend_free_spawn_instance (FridaDarwinHelperBackend * self, void * instance)
|
||||
_frida_darwin_helper_backend_close_spawn_instance (FridaDarwinHelperBackend * self, void * instance)
|
||||
{
|
||||
frida_spawn_instance_free (instance);
|
||||
frida_spawn_instance_close (instance);
|
||||
}
|
||||
|
||||
guint
|
||||
@@ -2477,7 +2496,7 @@ mach_failure:
|
||||
}
|
||||
failure:
|
||||
{
|
||||
frida_inject_instance_free (instance);
|
||||
frida_inject_instance_close (instance);
|
||||
goto beach;
|
||||
}
|
||||
beach:
|
||||
@@ -2583,16 +2602,24 @@ static gboolean
|
||||
frida_inject_instance_start_thread (FridaInjectInstance * self, GError ** error)
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
thread_state_t thread_state;
|
||||
mach_msg_type_number_t thread_state_count;
|
||||
kern_return_t kr;
|
||||
const gchar * failed_operation;
|
||||
FridaHelperContext * ctx = self->backend->context;
|
||||
FridaDispatchContext * ctx = self->backend->dispatch_context;
|
||||
dispatch_source_t source;
|
||||
|
||||
kr = thread_create (self->task, &self->thread);
|
||||
CHECK_MACH_RESULT (kr, ==, KERN_SUCCESS, "thread_create");
|
||||
thread_state = g_alloca (self->thread_state_count * sizeof (natural_t));
|
||||
thread_state_count = self->thread_state_count;
|
||||
|
||||
kr = frida_set_thread_state (self->thread, self->thread_state_flavor, self->thread_state_data, self->thread_state_count);
|
||||
CHECK_MACH_RESULT (kr, ==, KERN_SUCCESS, "set_thread_state");
|
||||
if (!frida_convert_thread_state_for_task (self->task, self->thread_state_flavor, self->thread_state_data, self->thread_state_count,
|
||||
thread_state, &thread_state_count, error))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
kr = thread_create_running (self->task, self->thread_state_flavor, thread_state, thread_state_count, &self->thread);
|
||||
CHECK_MACH_RESULT (kr, ==, KERN_SUCCESS, "thread_create");
|
||||
|
||||
source = dispatch_source_create (DISPATCH_SOURCE_TYPE_MACH_SEND, self->thread, DISPATCH_MACH_SEND_DEAD, ctx->dispatch_queue);
|
||||
self->thread_monitor_source = source;
|
||||
@@ -2601,9 +2628,6 @@ frida_inject_instance_start_thread (FridaInjectInstance * self, GError ** error)
|
||||
dispatch_source_set_event_handler_f (source, frida_inject_instance_on_mach_thread_dead);
|
||||
dispatch_resume (source);
|
||||
|
||||
kr = thread_resume (self->thread);
|
||||
CHECK_MACH_RESULT (kr, ==, KERN_SUCCESS, "thread_resume");
|
||||
|
||||
success = TRUE;
|
||||
|
||||
goto beach;
|
||||
@@ -2629,7 +2653,7 @@ frida_inject_instance_on_thread_monitor_cancel (void * context)
|
||||
FridaInjectInstance * self = context;
|
||||
|
||||
dispatch_release (g_steal_pointer (&self->thread_monitor_source));
|
||||
frida_inject_instance_free (self);
|
||||
frida_inject_instance_close (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2688,7 +2712,7 @@ _frida_darwin_helper_backend_join_inject_instance_posix_thread (FridaDarwinHelpe
|
||||
static void
|
||||
frida_inject_instance_join_posix_thread (FridaInjectInstance * self, mach_port_t posix_thread)
|
||||
{
|
||||
FridaHelperContext * ctx = self->backend->context;
|
||||
FridaDispatchContext * ctx = self->backend->dispatch_context;
|
||||
mach_port_t self_task;
|
||||
dispatch_source_t source;
|
||||
|
||||
@@ -2721,9 +2745,9 @@ _frida_darwin_helper_backend_get_pid_of_inject_instance (FridaDarwinHelperBacken
|
||||
}
|
||||
|
||||
void
|
||||
_frida_darwin_helper_backend_free_inject_instance (FridaDarwinHelperBackend * self, void * instance)
|
||||
_frida_darwin_helper_backend_close_inject_instance (FridaDarwinHelperBackend * self, void * instance)
|
||||
{
|
||||
frida_inject_instance_free (instance);
|
||||
frida_inject_instance_close (instance);
|
||||
}
|
||||
|
||||
static FridaSpawnInstance *
|
||||
@@ -2733,7 +2757,7 @@ frida_spawn_instance_new (FridaDarwinHelperBackend * backend)
|
||||
guint i;
|
||||
|
||||
instance = g_slice_new0 (FridaSpawnInstance);
|
||||
instance->backend = backend;
|
||||
instance->backend = g_object_ref (backend);
|
||||
instance->thread = MACH_PORT_NULL;
|
||||
|
||||
instance->server_port = MACH_PORT_NULL;
|
||||
@@ -2756,11 +2780,13 @@ frida_spawn_instance_new (FridaDarwinHelperBackend * backend)
|
||||
instance->page_pool[i].scratch_page = 0;
|
||||
}
|
||||
|
||||
_frida_darwin_helper_backend_on_instance_created (backend, instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
static void
|
||||
frida_spawn_instance_free (FridaSpawnInstance * instance)
|
||||
frida_spawn_instance_close (FridaSpawnInstance * instance)
|
||||
{
|
||||
task_t self_task;
|
||||
FridaExceptionPortSet * previous_ports;
|
||||
@@ -2799,6 +2825,9 @@ frida_spawn_instance_free (FridaSpawnInstance * instance)
|
||||
if (instance->dyld != NULL)
|
||||
g_object_unref (instance->dyld);
|
||||
|
||||
_frida_darwin_helper_backend_on_instance_destroyed (instance->backend, instance);
|
||||
g_object_unref (instance->backend);
|
||||
|
||||
g_slice_free (FridaSpawnInstance, instance);
|
||||
}
|
||||
|
||||
@@ -2841,7 +2870,7 @@ frida_spawn_instance_on_server_cancel (void * context)
|
||||
FridaSpawnInstance * self = context;
|
||||
|
||||
dispatch_release (g_steal_pointer (&self->server_recv_source));
|
||||
frida_spawn_instance_free (self);
|
||||
frida_spawn_instance_close (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3078,9 +3107,15 @@ frida_spawn_instance_handle_breakpoint (FridaSpawnInstance * self, FridaBreakpoi
|
||||
if (self->dyld_flavor == FRIDA_DYLD_V4_PLUS)
|
||||
{
|
||||
if (pc == self->modern_entry_address)
|
||||
self->breakpoint_phase = FRIDA_BREAKPOINT_SET_LIBDYLD_INITIALIZE_CALLER_BREAKPOINT;
|
||||
{
|
||||
self->breakpoint_phase = (pc == self->notify_objc_init)
|
||||
? FRIDA_BREAKPOINT_LIBSYSTEM_INITIALIZED
|
||||
: FRIDA_BREAKPOINT_SET_LIBDYLD_INITIALIZE_CALLER_BREAKPOINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return frida_spawn_instance_handle_dyld_restart (self);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3346,6 +3381,7 @@ frida_spawn_instance_handle_dyld_restart (FridaSpawnInstance * self)
|
||||
GumAddress * info_ptr;
|
||||
struct dyld_all_image_infos * info = NULL;
|
||||
GumDarwinModule * dyld = NULL;
|
||||
gssize delta;
|
||||
|
||||
info_ptr = (GumAddress *) gum_darwin_read (self->task, self->info_ptr_address, sizeof (GumAddress), NULL);
|
||||
if (info_ptr == NULL)
|
||||
@@ -3360,7 +3396,11 @@ frida_spawn_instance_handle_dyld_restart (FridaSpawnInstance * self)
|
||||
if (dyld == NULL)
|
||||
goto beach;
|
||||
|
||||
self->modern_entry_address = GUM_ADDRESS (info->dyldImageLoadAddress) + (self->modern_entry_address - self->dyld->base_address);
|
||||
delta = (gssize) info->dyldImageLoadAddress - (gssize) self->dyld->base_address;
|
||||
|
||||
self->modern_entry_address += delta;
|
||||
if (self->notify_objc_init != 0)
|
||||
self->notify_objc_init += delta;
|
||||
|
||||
g_object_unref (self->dyld);
|
||||
self->dyld = g_steal_pointer (&dyld);
|
||||
@@ -3618,22 +3658,25 @@ frida_spawn_instance_destroy_dyld_data (FridaSpawnInstance * self)
|
||||
#if defined (HAVE_IOS) || defined (HAVE_TVOS)
|
||||
|
||||
static gboolean
|
||||
frida_pick_ios_tvos_bootstrapper (const GumModuleDetails * details, gpointer user_data)
|
||||
frida_pick_ios_tvos_bootstrapper (GumModule * module, gpointer user_data)
|
||||
{
|
||||
FridaSpawnInstanceDyldData * data = user_data;
|
||||
const gchar * path;
|
||||
const gchar * candidates[] = {
|
||||
"/usr/lib/substitute-inserter.dylib",
|
||||
"/usr/lib/pspawn_payload-stg2.dylib"
|
||||
};
|
||||
guint i;
|
||||
|
||||
path = gum_module_get_path (module);
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS (candidates); i++)
|
||||
{
|
||||
const gchar * bootstrapper = candidates[i];
|
||||
|
||||
if (strcmp (details->path, bootstrapper) == 0)
|
||||
if (strcmp (path, bootstrapper) == 0)
|
||||
{
|
||||
strcpy (data->bootstrapper, details->path);
|
||||
strcpy (data->bootstrapper, path);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -3796,15 +3839,15 @@ frida_spawn_instance_call_dlopen (FridaSpawnInstance * self, GumDarwinUnifiedThr
|
||||
}
|
||||
|
||||
static gboolean
|
||||
frida_find_cf_initialize (const GumModuleDetails * details, gpointer user_data)
|
||||
frida_find_cf_initialize (GumModule * module, gpointer user_data)
|
||||
{
|
||||
FridaSpawnInstance * self = user_data;
|
||||
GumDarwinModule * core_foundation;
|
||||
|
||||
if (strcmp (details->path, CORE_FOUNDATION) != 0)
|
||||
if (strcmp (gum_module_get_path (module), CORE_FOUNDATION) != 0)
|
||||
return TRUE;
|
||||
|
||||
core_foundation = gum_darwin_module_new_from_memory (CORE_FOUNDATION, self->task, details->range->base_address,
|
||||
core_foundation = gum_darwin_module_new_from_memory (CORE_FOUNDATION, self->task, gum_module_get_range (module)->base_address,
|
||||
GUM_DARWIN_MODULE_FLAGS_NONE, NULL);
|
||||
|
||||
self->cf_initialize_address = gum_darwin_module_resolve_symbol_address (core_foundation, "___CFInitialize");
|
||||
@@ -4083,6 +4126,8 @@ frida_inject_instance_new (FridaDarwinHelperBackend * backend, guint id, guint p
|
||||
|
||||
instance->backend = g_object_ref (backend);
|
||||
|
||||
_frida_darwin_helper_backend_on_instance_created (backend, instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -4112,11 +4157,13 @@ frida_inject_instance_clone (const FridaInjectInstance * instance, guint id)
|
||||
|
||||
g_object_ref (clone->backend);
|
||||
|
||||
_frida_darwin_helper_backend_on_instance_created (clone->backend, clone);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
static void
|
||||
frida_inject_instance_free (FridaInjectInstance * instance)
|
||||
frida_inject_instance_close (FridaInjectInstance * instance)
|
||||
{
|
||||
FridaAgentContext * agent_context = instance->agent_context;
|
||||
task_t self_task;
|
||||
@@ -4156,6 +4203,7 @@ frida_inject_instance_free (FridaInjectInstance * instance)
|
||||
if (instance->task != MACH_PORT_NULL)
|
||||
mach_port_deallocate (self_task, instance->task);
|
||||
|
||||
_frida_darwin_helper_backend_on_instance_destroyed (instance->backend, instance);
|
||||
g_object_unref (instance->backend);
|
||||
|
||||
g_slice_free (FridaInjectInstance, instance);
|
||||
@@ -4261,9 +4309,10 @@ frida_agent_context_init (FridaAgentContext * self, const FridaAgentDetails * de
|
||||
static gboolean
|
||||
frida_agent_context_init_functions (FridaAgentContext * self, GumDarwinModuleResolver * resolver, GumDarwinMapper * mapper, GError ** error)
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
GumDarwinModule * module;
|
||||
|
||||
module = gum_darwin_module_resolver_find_module (resolver, "/usr/lib/system/libsystem_kernel.dylib");
|
||||
module = gum_darwin_module_resolver_find_module_by_name (resolver, "/usr/lib/system/libsystem_kernel.dylib");
|
||||
if (module == NULL)
|
||||
goto no_libc;
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (mach_task_self);
|
||||
@@ -4272,8 +4321,10 @@ frida_agent_context_init_functions (FridaAgentContext * self, GumDarwinModuleRes
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (mach_msg_receive);
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (mach_port_destroy);
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (thread_terminate);
|
||||
g_object_unref (module);
|
||||
module = NULL;
|
||||
|
||||
module = gum_darwin_module_resolver_find_module (resolver, "/usr/lib/system/libsystem_pthread.dylib");
|
||||
module = gum_darwin_module_resolver_find_module_by_name (resolver, "/usr/lib/system/libsystem_pthread.dylib");
|
||||
if (module == NULL)
|
||||
goto no_libc;
|
||||
FRIDA_AGENT_CONTEXT_TRY_RESOLVE (pthread_create_from_mach_thread);
|
||||
@@ -4284,18 +4335,23 @@ frida_agent_context_init_functions (FridaAgentContext * self, GumDarwinModuleRes
|
||||
FRIDA_AGENT_CONTEXT_TRY_RESOLVE (pthread_threadid_np);
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (pthread_detach);
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (pthread_self);
|
||||
g_object_unref (module);
|
||||
module = NULL;
|
||||
|
||||
if (mapper == NULL)
|
||||
{
|
||||
module = gum_darwin_module_resolver_find_module (resolver, "/usr/lib/system/libdyld.dylib");
|
||||
module = gum_darwin_module_resolver_find_module_by_name (resolver, "/usr/lib/system/libdyld.dylib");
|
||||
if (module == NULL)
|
||||
goto no_libc;
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (dlopen);
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (dlsym);
|
||||
FRIDA_AGENT_CONTEXT_RESOLVE (dlclose);
|
||||
g_object_unref (module);
|
||||
module = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
success = TRUE;
|
||||
goto beach;
|
||||
|
||||
no_libc:
|
||||
{
|
||||
@@ -4303,7 +4359,7 @@ no_libc:
|
||||
FRIDA_ERROR,
|
||||
FRIDA_ERROR_NOT_SUPPORTED,
|
||||
"Unable to attach to processes without Apple's libc (for now)");
|
||||
goto failure;
|
||||
goto beach;
|
||||
}
|
||||
missing_symbol:
|
||||
{
|
||||
@@ -4311,11 +4367,13 @@ missing_symbol:
|
||||
FRIDA_ERROR,
|
||||
FRIDA_ERROR_NOT_SUPPORTED,
|
||||
"Unexpected error while resolving functions");
|
||||
goto failure;
|
||||
goto beach;
|
||||
}
|
||||
failure:
|
||||
beach:
|
||||
{
|
||||
return FALSE;
|
||||
g_clear_object (&module);
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5072,6 +5130,52 @@ frida_agent_context_emit_arm64_pthread_stub_body (FridaAgentContext * self, Frid
|
||||
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
frida_convert_thread_state_for_task (mach_port_t task, thread_state_flavor_t flavor, gconstpointer in_state,
|
||||
mach_msg_type_number_t in_state_count, gpointer out_state, mach_msg_type_number_t * out_state_count,
|
||||
GError ** error)
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
kern_return_t kr;
|
||||
const gchar * failed_operation;
|
||||
thread_act_array_t threads = NULL;
|
||||
mach_msg_type_number_t thread_count = 0;
|
||||
|
||||
kr = task_threads (task, &threads, &thread_count);
|
||||
CHECK_MACH_RESULT (kr, ==, KERN_SUCCESS, "task_threads");
|
||||
|
||||
kr = frida_convert_thread_state (threads[0], FRIDA_CONVERT_THREAD_STATE_OUT, flavor, in_state, in_state_count,
|
||||
out_state, out_state_count);
|
||||
CHECK_MACH_RESULT (kr, ==, KERN_SUCCESS, "thread_convert_thread_state");
|
||||
|
||||
success = TRUE;
|
||||
|
||||
goto beach;
|
||||
|
||||
mach_failure:
|
||||
{
|
||||
g_set_error (error,
|
||||
FRIDA_ERROR,
|
||||
FRIDA_ERROR_NOT_SUPPORTED,
|
||||
"Unexpected error while converting thread state for task (%s returned '%s')",
|
||||
failed_operation, mach_error_string (kr));
|
||||
goto beach;
|
||||
}
|
||||
beach:
|
||||
{
|
||||
mach_msg_type_number_t i;
|
||||
|
||||
if (threads != NULL)
|
||||
{
|
||||
for (i = 0; i != thread_count; i++)
|
||||
mach_port_deallocate (mach_task_self (), threads[i]);
|
||||
vm_deallocate (mach_task_self (), (vm_address_t) threads, thread_count * sizeof (thread_t));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
static mach_port_t
|
||||
frida_obtain_thread_port_for_thread_id (mach_port_t task, uint64_t thread_id)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace Frida {
|
||||
protected delegate void DispatchWorker ();
|
||||
protected delegate void LaunchCompletionHandler (owned StdioPipes? pipes, owned Error? error);
|
||||
|
||||
public void * context;
|
||||
private MainContext main_context;
|
||||
public void * dispatch_context;
|
||||
|
||||
public Gee.HashMap<uint, void *> spawn_instances = new Gee.HashMap<uint, void *> ();
|
||||
private Gee.HashMap<uint, OutputStream> stdin_streams = new Gee.HashMap<uint, OutputStream> ();
|
||||
@@ -32,6 +33,9 @@ namespace Frida {
|
||||
private Gee.HashMap<void *, uint> inject_cleaner_by_instance = new Gee.HashMap<void *, uint> ();
|
||||
private Gee.HashMap<uint, uint> inject_expiry_timers = new Gee.HashMap<uint, uint> ();
|
||||
|
||||
private Gee.Set<void *> instances = new Gee.HashSet<void *> ();
|
||||
private SourceFunc? on_last_instance_destroyed = null;
|
||||
|
||||
public uint next_id = 1;
|
||||
|
||||
private PolicySoftener policy_softener;
|
||||
@@ -40,7 +44,8 @@ namespace Frida {
|
||||
private Cancellable io_cancellable = new Cancellable ();
|
||||
|
||||
construct {
|
||||
_create_context ();
|
||||
main_context = MainContext.ref_thread_default ();
|
||||
_create_dispatch_context ();
|
||||
|
||||
dtrace_agent = DTraceAgent.try_open ();
|
||||
if (dtrace_agent != null) {
|
||||
@@ -63,11 +68,7 @@ namespace Frida {
|
||||
}
|
||||
|
||||
~DarwinHelperBackend () {
|
||||
foreach (var instance in spawn_instances.values)
|
||||
_free_spawn_instance (instance);
|
||||
foreach (var instance in inject_instances.values)
|
||||
_free_inject_instance (instance);
|
||||
_destroy_context ();
|
||||
_destroy_dispatch_context ();
|
||||
}
|
||||
|
||||
public async void close (Cancellable? cancellable) throws IOError {
|
||||
@@ -77,11 +78,24 @@ namespace Frida {
|
||||
pending.complete ();
|
||||
|
||||
foreach (var entry in inject_cleaner_by_instance.entries) {
|
||||
_free_inject_instance (entry.key);
|
||||
_close_inject_instance (entry.key);
|
||||
Source.remove (entry.value);
|
||||
}
|
||||
inject_cleaner_by_instance.clear ();
|
||||
|
||||
foreach (var instance in spawn_instances.values)
|
||||
_close_spawn_instance (instance);
|
||||
spawn_instances.clear ();
|
||||
|
||||
bool any_pending = false;
|
||||
lock (instances) {
|
||||
any_pending = !instances.is_empty;
|
||||
if (any_pending)
|
||||
on_last_instance_destroyed = close.callback;
|
||||
}
|
||||
if (any_pending)
|
||||
yield;
|
||||
|
||||
if (dtrace_agent != null) {
|
||||
dtrace_agent.spawn_added.disconnect (on_dtrace_agent_spawn_added);
|
||||
dtrace_agent.spawn_removed.disconnect (on_dtrace_agent_spawn_removed);
|
||||
@@ -139,11 +153,11 @@ namespace Frida {
|
||||
Error error = null;
|
||||
|
||||
_launch (identifier, options, (p, e) => {
|
||||
Idle.add (() => {
|
||||
schedule_on_frida_thread (() => {
|
||||
pipes = p;
|
||||
error = e;
|
||||
launch.callback ();
|
||||
return false;
|
||||
return Source.REMOVE;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -187,7 +201,7 @@ namespace Frida {
|
||||
inject_cleaner_by_instance.unset (instance, out source_id);
|
||||
Source.remove (source_id);
|
||||
|
||||
_free_inject_instance (instance);
|
||||
_close_inject_instance (instance);
|
||||
}
|
||||
|
||||
policy_softener.forget (pid);
|
||||
@@ -205,7 +219,7 @@ namespace Frida {
|
||||
|
||||
void * instance;
|
||||
if (spawn_instances.unset (pid, out instance))
|
||||
_free_spawn_instance (instance);
|
||||
_close_spawn_instance (instance);
|
||||
|
||||
child_dead (pid);
|
||||
}
|
||||
@@ -293,7 +307,7 @@ namespace Frida {
|
||||
void * instance;
|
||||
if (spawn_instances.unset (pid, out instance)) {
|
||||
_resume_spawn_instance (instance);
|
||||
_free_spawn_instance (instance);
|
||||
_close_spawn_instance (instance);
|
||||
} else {
|
||||
resume_with_validation (pid);
|
||||
}
|
||||
@@ -412,7 +426,7 @@ namespace Frida {
|
||||
} catch (GLib.Error e) {
|
||||
if (instance_created_here) {
|
||||
spawn_instances.unset (pid);
|
||||
_free_spawn_instance (spawn_instance);
|
||||
_close_spawn_instance (spawn_instance);
|
||||
}
|
||||
|
||||
throw_api_error (e);
|
||||
@@ -495,21 +509,21 @@ namespace Frida {
|
||||
}
|
||||
|
||||
public void _on_spawn_instance_ready (uint pid) {
|
||||
Idle.add (() => {
|
||||
schedule_on_frida_thread (() => {
|
||||
spawn_instance_ready (pid);
|
||||
return false;
|
||||
return Source.REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
public void _on_spawn_instance_error (uint pid, Error error) {
|
||||
Idle.add (() => {
|
||||
schedule_on_frida_thread (() => {
|
||||
spawn_instance_error (pid, error);
|
||||
return false;
|
||||
return Source.REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
public void _on_mach_thread_dead (uint id, void * posix_thread) {
|
||||
Idle.add (() => {
|
||||
schedule_on_frida_thread (() => {
|
||||
var instance = inject_instances[id];
|
||||
assert (instance != null);
|
||||
|
||||
@@ -518,14 +532,14 @@ namespace Frida {
|
||||
else
|
||||
_destroy_inject_instance (id);
|
||||
|
||||
return false;
|
||||
return Source.REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
public void _on_posix_thread_dead (uint id) {
|
||||
Idle.add (() => {
|
||||
schedule_on_frida_thread (() => {
|
||||
_destroy_inject_instance (id);
|
||||
return false;
|
||||
return Source.REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -545,7 +559,7 @@ namespace Frida {
|
||||
private void schedule_inject_instance_cleanup (void * instance) {
|
||||
var cleanup_source = new TimeoutSource (50);
|
||||
cleanup_source.set_callback (() => {
|
||||
_free_inject_instance (instance);
|
||||
_close_inject_instance (instance);
|
||||
|
||||
var removed = inject_cleaner_by_instance.unset (instance);
|
||||
assert (removed);
|
||||
@@ -601,6 +615,19 @@ namespace Frida {
|
||||
policy_softener.forget (pid);
|
||||
}
|
||||
|
||||
public void _on_instance_created (void * instance) {
|
||||
lock (instances)
|
||||
instances.add (instance);
|
||||
}
|
||||
|
||||
public void _on_instance_destroyed (void * instance) {
|
||||
lock (instances) {
|
||||
instances.remove (instance);
|
||||
if (on_last_instance_destroyed != null && instances.is_empty)
|
||||
schedule_on_frida_thread ((owned) on_last_instance_destroyed);
|
||||
}
|
||||
}
|
||||
|
||||
private void on_dtrace_agent_spawn_added (HostSpawnInfo info) {
|
||||
spawn_added (info);
|
||||
}
|
||||
@@ -611,11 +638,17 @@ namespace Frida {
|
||||
|
||||
private async void flush_dispatch_queue () {
|
||||
_schedule_on_dispatch_queue (() => {
|
||||
Idle.add (flush_dispatch_queue.callback);
|
||||
schedule_on_frida_thread (flush_dispatch_queue.callback);
|
||||
});
|
||||
yield;
|
||||
}
|
||||
|
||||
private void schedule_on_frida_thread (owned SourceFunc function) {
|
||||
var source = new IdleSource ();
|
||||
source.set_callback ((owned) function);
|
||||
source.attach (main_context);
|
||||
}
|
||||
|
||||
public extern static PipeEndpoints make_pipe_endpoints (uint local_task, uint remote_pid, uint remote_task) throws Error;
|
||||
public extern static void make_pipe_endpoint_from_socket (uint pid, uint task, GLib.Socket sock, out string address)
|
||||
throws Error;
|
||||
@@ -626,8 +659,8 @@ namespace Frida {
|
||||
public extern static bool is_mmap_available ();
|
||||
public extern static MappedLibraryBlob mmap (uint task, Bytes blob) throws Error;
|
||||
|
||||
protected extern void _create_context ();
|
||||
protected extern void _destroy_context ();
|
||||
protected extern void _create_dispatch_context ();
|
||||
protected extern void _destroy_dispatch_context ();
|
||||
protected extern void _schedule_on_dispatch_queue (DispatchWorker worker);
|
||||
|
||||
protected extern uint _spawn (string path, HostSpawnOptions options, out StdioPipes? pipes) throws Error;
|
||||
@@ -642,7 +675,7 @@ namespace Frida {
|
||||
protected extern void * _create_spawn_instance (uint pid);
|
||||
protected extern void _prepare_spawn_instance_for_injection (void * instance, uint task) throws Error;
|
||||
protected extern void _resume_spawn_instance (void * instance);
|
||||
protected extern void _free_spawn_instance (void * instance);
|
||||
protected extern void _close_spawn_instance (void * instance);
|
||||
|
||||
protected extern uint _inject_into_task (uint pid, uint task, string path_or_name, MappedLibraryBlob? blob, string entrypoint, string data) throws Error;
|
||||
protected extern void _demonitor (void * instance);
|
||||
@@ -650,10 +683,10 @@ namespace Frida {
|
||||
protected extern void _recreate_injectee_thread (void * instance, uint pid, uint task) throws Error;
|
||||
protected extern void _join_inject_instance_posix_thread (void * instance, void * posix_thread);
|
||||
protected extern uint _get_pid_of_inject_instance (void * instance);
|
||||
protected extern void _free_inject_instance (void * instance);
|
||||
protected extern void _close_inject_instance (void * instance);
|
||||
}
|
||||
|
||||
public class DTraceAgent : Object {
|
||||
public sealed class DTraceAgent : Object {
|
||||
public signal void spawn_added (HostSpawnInfo info);
|
||||
public signal void spawn_removed (HostSpawnInfo info);
|
||||
|
||||
@@ -812,7 +845,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class PendingLaunch : Object {
|
||||
private sealed class PendingLaunch : Object {
|
||||
public signal void completed ();
|
||||
|
||||
public string identifier {
|
||||
@@ -856,7 +889,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class StdioPipes : Object {
|
||||
public sealed class StdioPipes : Object {
|
||||
public int input {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class DarwinHelperBackend : Object, DarwinHelper {
|
||||
public sealed class DarwinHelperBackend : Object, DarwinHelper {
|
||||
public signal void idle ();
|
||||
public signal void child_dead (uint pid);
|
||||
public signal void spawn_instance_ready (uint pid);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class DarwinHelperProcess : Object, DarwinHelper {
|
||||
public sealed class DarwinHelperProcess : Object, DarwinHelper {
|
||||
public uint pid {
|
||||
get {
|
||||
return (uint) process_pid;
|
||||
@@ -473,7 +473,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
private class ResourceStore {
|
||||
private sealed class ResourceStore {
|
||||
public HelperFile helper {
|
||||
get;
|
||||
private set;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Frida {
|
||||
public extern void _start_run_loop ();
|
||||
public extern void _stop_run_loop ();
|
||||
|
||||
public class DarwinHelperService : Object, DarwinRemoteHelper {
|
||||
public sealed class DarwinHelperService : Object, DarwinRemoteHelper {
|
||||
public string parent_address {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Frida {
|
||||
public class Fruitjector : Object, Injector {
|
||||
public sealed class Fruitjector : Object, Injector {
|
||||
public signal void injected (uint id, uint pid, bool has_mapped_module, DarwinModuleDetails mapped_module);
|
||||
|
||||
public DarwinHelper helper {
|
||||
@@ -117,7 +117,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class AgentResource : Object {
|
||||
public sealed class AgentResource : Object {
|
||||
public string name {
|
||||
get;
|
||||
construct;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Frida {
|
||||
public abstract void forget (uint pid);
|
||||
}
|
||||
|
||||
public class NullPolicySoftener : Object, PolicySoftener {
|
||||
public sealed class NullPolicySoftener : Object, PolicySoftener {
|
||||
public void soften (uint pid) throws Error {
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Frida {
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalIOSTVOSPolicySoftener : IOSTVOSPolicySoftener {
|
||||
public sealed class InternalIOSTVOSPolicySoftener : IOSTVOSPolicySoftener {
|
||||
private static bool enabled = false;
|
||||
|
||||
public static void enable () {
|
||||
@@ -184,7 +184,7 @@ namespace Frida {
|
||||
private extern static void _soften (uint pid) throws Error;
|
||||
}
|
||||
|
||||
public class ElectraPolicySoftener : IOSTVOSPolicySoftener {
|
||||
public sealed class ElectraPolicySoftener : IOSTVOSPolicySoftener {
|
||||
private const string LIBJAILBREAK_PATH = "/usr/lib/libjailbreak.dylib";
|
||||
|
||||
private Module libjailbreak;
|
||||
@@ -237,7 +237,7 @@ namespace Frida {
|
||||
private extern static int _internal_jb_entitle_now (void * jbd_call, uint connection, uint pid);
|
||||
}
|
||||
|
||||
public class Unc0verPolicySoftener : IOSTVOSPolicySoftener {
|
||||
public sealed class Unc0verPolicySoftener : IOSTVOSPolicySoftener {
|
||||
private const string SUBSTITUTED_PATH = "/usr/libexec/substituted";
|
||||
|
||||
private uint connection;
|
||||
|
||||
@@ -151,10 +151,12 @@ frida_replacement_xpc_look_up_endpoint (const char * service_name, uint32_t type
|
||||
static FridaXpcLookUpEndpointFunc
|
||||
frida_find_xpc_look_up_endpoint_implementation (void)
|
||||
{
|
||||
GumModule * libxpc;
|
||||
guint32 * cursor;
|
||||
|
||||
cursor = GSIZE_TO_POINTER (
|
||||
gum_strip_code_address (gum_module_find_export_by_name ("/usr/lib/system/libxpc.dylib", "xpc_endpoint_create_bs_named")));
|
||||
libxpc = gum_process_find_module_by_name ("/usr/lib/system/libxpc.dylib");
|
||||
cursor = GSIZE_TO_POINTER (gum_strip_code_address (gum_module_find_export_by_name (libxpc, "xpc_endpoint_create_bs_named")));
|
||||
g_object_unref (libxpc);
|
||||
if (cursor == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
devkit_outputs = [
|
||||
'frida-core.gir',
|
||||
'frida-core.h',
|
||||
static_lib_prefix + 'frida-core' + static_lib_suffix,
|
||||
'frida-core-example.c',
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Frida.AXML {
|
||||
}
|
||||
}
|
||||
|
||||
public class ElementTree : Object {
|
||||
public sealed class ElementTree : Object {
|
||||
public string name {
|
||||
get;
|
||||
set;
|
||||
@@ -135,7 +135,7 @@ namespace Frida.AXML {
|
||||
}
|
||||
}
|
||||
|
||||
public class ResourceValue : Object {
|
||||
public sealed class ResourceValue : Object {
|
||||
private uint16 size;
|
||||
private uint8 unused;
|
||||
private ResourceType type;
|
||||
@@ -173,7 +173,7 @@ namespace Frida.AXML {
|
||||
}
|
||||
}
|
||||
|
||||
public class Attribute : Object {
|
||||
public sealed class Attribute : Object {
|
||||
private uint32 namespace;
|
||||
private uint32 name;
|
||||
private uint32 unused;
|
||||
@@ -238,7 +238,7 @@ namespace Frida.AXML {
|
||||
}
|
||||
}
|
||||
|
||||
private class ResourceMap {
|
||||
private sealed class ResourceMap {
|
||||
private Gee.ArrayList<uint32> resources = new Gee.ArrayList<uint32> ();
|
||||
|
||||
public ResourceMap.with_stream (DataInputStream input, uint32 size) throws IOError {
|
||||
@@ -247,7 +247,7 @@ namespace Frida.AXML {
|
||||
}
|
||||
}
|
||||
|
||||
private class StringPool {
|
||||
private sealed class StringPool {
|
||||
private uint32 flags;
|
||||
private Gee.ArrayList<string> strings = new Gee.ArrayList<string> ();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[CCode (gir_namespace = "FridaDroidy", gir_version = "1.0")]
|
||||
namespace Frida.Droidy {
|
||||
public class DeviceTracker : Object {
|
||||
public sealed class DeviceTracker : Object {
|
||||
public signal void device_attached (DeviceDetails details);
|
||||
public signal void device_detached (string serial);
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceDetails : Object {
|
||||
public sealed class DeviceDetails : Object {
|
||||
public string serial {
|
||||
get;
|
||||
construct;
|
||||
@@ -205,7 +205,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
}
|
||||
|
||||
public class ShellSession : Object {
|
||||
public sealed class ShellSession : Object {
|
||||
public signal void output (StdioPipe pipe, Bytes bytes);
|
||||
public signal void closed ();
|
||||
|
||||
@@ -594,7 +594,7 @@ namespace Frida.Droidy {
|
||||
STDERR
|
||||
}
|
||||
|
||||
public class ShellCommandResult : Object {
|
||||
public sealed class ShellCommandResult : Object {
|
||||
public uint8 status {
|
||||
get;
|
||||
construct;
|
||||
@@ -686,7 +686,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
}
|
||||
|
||||
public class FileMetadata : Object {
|
||||
public sealed class FileMetadata : Object {
|
||||
public uint32 mode {
|
||||
get;
|
||||
set;
|
||||
@@ -700,7 +700,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
}
|
||||
|
||||
public class JDWPTracker : Object {
|
||||
public sealed class JDWPTracker : Object {
|
||||
public signal void debugger_attached (uint pid);
|
||||
public signal void debugger_detached (uint pid);
|
||||
|
||||
@@ -768,7 +768,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
}
|
||||
|
||||
public class Client : Object {
|
||||
public sealed class Client : Object {
|
||||
public signal void closed ();
|
||||
public signal void message (string payload);
|
||||
|
||||
@@ -791,7 +791,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
|
||||
private const uint16 ADB_SERVER_DEFAULT_PORT = 5037;
|
||||
private const uint16 MAX_MESSAGE_LENGTH = 1024;
|
||||
private const size_t MAX_MESSAGE_LENGTH = 65536;
|
||||
|
||||
public static async Client open (Cancellable? cancellable = null) throws Error, IOError {
|
||||
SocketConnectable? connectable = null;
|
||||
@@ -1154,7 +1154,7 @@ namespace Frida.Droidy {
|
||||
}
|
||||
}
|
||||
|
||||
public class SyncSession : Object {
|
||||
public sealed class SyncSession : Object {
|
||||
public Client client {
|
||||
get;
|
||||
construct;
|
||||
|
||||
Loaded 100 of 279 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user