├── magisk ├── META-INF │ └── com │ │ └── google │ │ └── android │ │ ├── updater-script │ │ └── update-binary ├── common │ ├── system.prop │ ├── post-fs-data.sh │ └── service.sh └── install.sh ├── img ├── 1.png ├── 2.png └── 3.png ├── CHANGELOG.md ├── asenosen ├── frida-gum │ └── 0001-main-loop-rename.patch └── frida-core │ └── 0001-socket-thread-secontext-renames.patch ├── rycoh99 └── frida-core │ └── 0001-pause-on-gadget-inject.patch ├── florida ├── frida-gum │ └── 0001-Florida-pool-frida.patch └── frida-core │ ├── 0001-Florida-memfd-name-jit-cache.patch │ └── 0002-Florida-pool-frida.patch ├── elliott-wen └── frida-core │ ├── 0002-listen-everywhere.patch │ └── 0001-alter-ports.patch ├── strongR-frida └── frida-core │ ├── 0008-protocol_unexpected_command.patch │ ├── 0003-pipe_linjector.patch.deprecated-reworked │ ├── 0002-io_re_frida_server.patch │ ├── 0009-memory_str.patch │ ├── 0006-anti-anti-frida.py.patch │ ├── 0001-string_frida_rpc.patch │ ├── 0004-io_frida_agent_so.patch │ ├── 0007-threads.patch │ └── 0005-symbol_frida_agent_main.patch.deprecated ├── zer0def └── frida-gum │ └── 0001-fixup-exact-gum-deps.patch ├── fridare └── frida-core │ └── 0001.patch ├── pyconfig.h-i686-x86_64.patch ├── README.md ├── soyasoya5 └── frida-gum │ └── 0001-il2cpp.patch ├── .github └── workflows │ └── build.yml ├── aimardcr └── gumjs-quote-detection-bypass-unquote.patch └── LICENSE /magisk/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zer0def/undetected-frida/HEAD/img/1.png -------------------------------------------------------------------------------- /img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zer0def/undetected-frida/HEAD/img/2.png -------------------------------------------------------------------------------- /img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zer0def/undetected-frida/HEAD/img/3.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | See [https://frida.re/news/](https://frida.re/news/) for details. 2 | -------------------------------------------------------------------------------- /magisk/common/system.prop: -------------------------------------------------------------------------------- 1 | # This file will be read by resetprop 2 | # Example: Change dpi 3 | # ro.sf.lcd_density=320 4 | -------------------------------------------------------------------------------- /magisk/common/post-fs-data.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Do NOT assume where your module will be located. 3 | # ALWAYS use $MODDIR if you need to know where this script 4 | # and module is placed. 5 | # This will make sure your module will still work 6 | # if Magisk change its mount point in the future 7 | MODDIR=${0%/*} 8 | 9 | # This script will be executed in post-fs-data mode 10 | -------------------------------------------------------------------------------- /asenosen/frida-gum/0001-main-loop-rename.patch: -------------------------------------------------------------------------------- 1 | diff --git a/bindings/gumjs/gumscriptscheduler.c b/bindings/gumjs/gumscriptscheduler.c 2 | index b86a6c57..2459c874 100644 3 | --- a/bindings/gumjs/gumscriptscheduler.c 4 | +++ b/bindings/gumjs/gumscriptscheduler.c 5 | @@ -114,7 +114,7 @@ gum_script_scheduler_start (GumScriptScheduler * self) 6 | { 7 | self->js_loop = g_main_loop_new (self->js_context, TRUE); 8 | 9 | - self->js_thread = g_thread_new ("gum-js-loop", 10 | + self->js_thread = g_thread_new ("${FRIDA_PREFIX}-gjs-loop", 11 | (GThreadFunc) gum_script_scheduler_run_js_loop, self); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /rycoh99/frida-core/0001-pause-on-gadget-inject.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/gadget/gadget.vala b/lib/gadget/gadget.vala 2 | index 9b2aa92b..1b6aabbd 100644 3 | --- a/lib/gadget/gadget.vala 4 | +++ b/lib/gadget/gadget.vala 5 | @@ -1762,7 +1762,7 @@ namespace Frida.Gadget { 6 | private HostApplicationInfo this_app; 7 | private HostProcessInfo this_process; 8 | private TimeoutSource? ping_timer; 9 | - private bool resume_on_attach = true; 10 | + private bool resume_on_attach = false; 11 | 12 | public ControlChannel (ControlServer parent, DBusConnection connection) { 13 | Object (parent: parent, connection: connection); 14 | -------------------------------------------------------------------------------- /magisk/common/service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Do NOT assume where your module will be located. 3 | # ALWAYS use $MODDIR if you need to know where this script 4 | # and module is placed. 5 | # This will make sure your module will still work 6 | # if Magisk change its mount point in the future 7 | MODDIR=${0%/*} 8 | 9 | # This script will be executed in late_start service mode 10 | 11 | # wait for boot to complete 12 | while [ "$(getprop sys.boot_completed)" != 1 ]; do 13 | sleep 1 14 | done 15 | 16 | # ensure boot has actually completed 17 | sleep 5 18 | 19 | # restart on crash 20 | while true; do 21 | com.android.systemui & 22 | kill -INT "${!}"; wait 23 | sleep 1 24 | done 25 | -------------------------------------------------------------------------------- /florida/frida-gum/0001-Florida-pool-frida.patch: -------------------------------------------------------------------------------- 1 | From 649c04e3fb19596621f347d05c45c8c30d1a0fa7 Mon Sep 17 00:00:00 2001 2 | From: Ylarod 3 | Date: Thu, 20 Jul 2023 10:26:34 +0800 4 | Subject: [PATCH] Florida: pool-frida 5 | 6 | --- 7 | gum/gum.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/gum/gum.c b/gum/gum.c 11 | index f6e6243f..3305f629 100644 12 | --- a/gum/gum.c 13 | +++ b/gum/gum.c 14 | @@ -304,7 +304,7 @@ gum_init_embedded (void) 15 | g_log_set_default_handler (gum_on_log_message, NULL); 16 | gum_do_init (); 17 | 18 | - g_set_prgname ("frida"); 19 | + g_set_prgname ("${FRIDA_PREFIX}"); 20 | 21 | #if defined (HAVE_LINUX) && defined (HAVE_GLIBC) 22 | gum_libdl_prevent_unload (); 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /florida/frida-core/0001-Florida-memfd-name-jit-cache.patch: -------------------------------------------------------------------------------- 1 | From 5b1279a54e7fc5b9867332d16d5b30ea16bf6b7a Mon Sep 17 00:00:00 2001 2 | From: Ylarod 3 | Date: Fri, 1 Sep 2023 12:51:06 +0800 4 | Subject: [PATCH 9/9] Florida: memfd-name-jit-cache 5 | 6 | --- 7 | lib/base/linux.vala | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/lib/base/linux.vala b/lib/base/linux.vala 11 | index 02ad955a..90ba9513 100644 12 | --- a/lib/base/linux.vala 13 | +++ b/lib/base/linux.vala 14 | @@ -101,7 +101,7 @@ namespace Frida { 15 | } 16 | 17 | private int memfd_create (string name, uint flags) { 18 | - return Linux.syscall (SysCall.memfd_create, name, flags); 19 | + return Linux.syscall (SysCall.memfd_create, "jit-cache", flags); 20 | } 21 | } 22 | } 23 | -- 24 | 2.42.0 25 | -------------------------------------------------------------------------------- /florida/frida-core/0002-Florida-pool-frida.patch: -------------------------------------------------------------------------------- 1 | From 4b88bae0ba2d67a8ac2b1ffbd2d2216e879c3813 Mon Sep 17 00:00:00 2001 2 | From: Ylarod 3 | Date: Thu, 20 Jul 2023 10:01:20 +0800 4 | Subject: [PATCH 09/10] Florida: pool-frida 5 | 6 | --- 7 | src/frida-glue.c | 2 ++ 8 | 1 file changed, 2 insertions(+) 9 | 10 | diff --git a/src/frida-glue.c b/src/frida-glue.c 11 | index ee8f0737..43cc8167 100644 12 | --- a/src/frida-glue.c 13 | +++ b/src/frida-glue.c 14 | @@ -40,6 +40,8 @@ frida_init_with_runtime (FridaRuntime rt) 15 | g_io_module_openssl_register (); 16 | #endif 17 | 18 | + g_set_prgname ("${FRIDA_PREFIX}"); 19 | + 20 | if (runtime == FRIDA_RUNTIME_OTHER) 21 | { 22 | main_context = g_main_context_ref (g_main_context_default ()); 23 | -- 24 | 2.39.3 (Apple Git-145) 25 | 26 | -------------------------------------------------------------------------------- /elliott-wen/frida-core/0002-listen-everywhere.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/base/socket.vala b/lib/base/socket.vala 2 | index 1ba8d338..0c8f04b2 100644 3 | --- a/lib/base/socket.vala 4 | +++ b/lib/base/socket.vala 5 | @@ -3,10 +3,10 @@ namespace Frida { 6 | 7 | public SocketConnectable parse_control_address (string? address, uint16 port = 0) throws Error { 8 | - return parse_socket_address (address, port, "127.0.0.1", DEFAULT_CONTROL_PORT); 9 | + return parse_socket_address (address, port, "0.0.0.0", DEFAULT_CONTROL_PORT); 10 | } 11 | 12 | public SocketConnectable parse_cluster_address (string? address, uint16 port = 0) throws Error { 13 | - return parse_socket_address (address, port, "127.0.0.1", DEFAULT_CLUSTER_PORT); 14 | + return parse_socket_address (address, port, "0.0.0.0", DEFAULT_CLUSTER_PORT); 15 | } 16 | 17 | public SocketConnectable parse_socket_address (string? address, uint16 port, string default_address, 18 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0008-protocol_unexpected_command.patch: -------------------------------------------------------------------------------- 1 | From 1c19492c453426c6b9f7af868e9b24b0734d9617 Mon Sep 17 00:00:00 2001 2 | From: hluwa 3 | Date: Mon, 16 Aug 2021 10:55:11 +0800 4 | Subject: [PATCH 8/8] strongR-frida: protocol_unexpected_command 5 | 6 | --- 7 | src/droidy/droidy-client.vala | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/src/droidy/droidy-client.vala b/src/droidy/droidy-client.vala 11 | index e784e0d1..95ca0deb 100644 12 | --- a/src/droidy/droidy-client.vala 13 | +++ b/src/droidy/droidy-client.vala 14 | @@ -974,7 +974,7 @@ namespace Frida.Droidy { 15 | case "OPEN": 16 | case "CLSE": 17 | case "WRTE": 18 | - throw new Error.PROTOCOL ("Unexpected command"); 19 | + break; // throw new Error.PROTOCOL ("Unexpected command"); 20 | 21 | default: 22 | var length = parse_length (command_or_length); 23 | -- 24 | 2.39.3 (Apple Git-145) 25 | 26 | -------------------------------------------------------------------------------- /elliott-wen/frida-core/0001-alter-ports.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/base/socket.vala b/lib/base/socket.vala 2 | index 1ba8d338..065f2d09 100644 3 | --- a/lib/base/socket.vala 4 | +++ b/lib/base/socket.vala 5 | @@ -1,5 +1,5 @@ 6 | namespace Frida { 7 | - public const uint16 DEFAULT_CONTROL_PORT = 27042; 8 | - public const uint16 DEFAULT_CLUSTER_PORT = 27052; 9 | + public const uint16 DEFAULT_CONTROL_PORT = 37042; 10 | + public const uint16 DEFAULT_CLUSTER_PORT = 37052; 11 | 12 | public SocketConnectable parse_control_address (string? address, uint16 port = 0) throws Error { 13 | diff --git a/lib/gadget/gadget.vala b/lib/gadget/gadget.vala 14 | index 230284c7..8f0cab0a 100644 15 | --- a/lib/gadget/gadget.vala 16 | +++ b/lib/gadget/gadget.vala 17 | @@ -202,7 +202,7 @@ namespace Frida.Gadget { 18 | public PortConflictBehavior on_port_conflict { 19 | get; 20 | set; 21 | - default = PortConflictBehavior.FAIL; 22 | + default = PortConflictBehavior.PICK_NEXT; 23 | } 24 | 25 | public LoadBehavior on_load { 26 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0003-pipe_linjector.patch.deprecated-reworked: -------------------------------------------------------------------------------- 1 | From 7a036bdfb159ad73bb208647555e2c632760e743 Mon Sep 17 00:00:00 2001 2 | From: hluwa 3 | Date: Mon, 16 Aug 2021 10:55:11 +0800 4 | Subject: [PATCH 3/8] strongR-frida: pipe_linjector 5 | 6 | --- 7 | src/linux/frida-helper-backend-glue.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/src/linux/frida-helper-backend-glue.c b/src/linux/frida-helper-backend-glue.c 11 | index b99963a1..3a8dbfa2 100644 12 | --- a/src/linux/frida-helper-backend-glue.c 13 | +++ b/src/linux/frida-helper-backend-glue.c 14 | @@ -947,7 +947,7 @@ frida_inject_instance_init_fifo (FridaInjectInstance * self) 15 | { 16 | const int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; 17 | 18 | - self->fifo_path = g_strdup_printf ("%s/linjector-%u", self->temp_path, self->id); 19 | + self->fifo_path = g_strdup_printf ("%s/%p%u", self->temp_path, self ,self->id); 20 | 21 | mkfifo (self->fifo_path, mode); 22 | chmod (self->fifo_path, mode); 23 | -- 24 | 2.30.2 25 | 26 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0002-io_re_frida_server.patch: -------------------------------------------------------------------------------- 1 | From aafd3e9f938e6e94d6b181718b0c2d85192168b4 Mon Sep 17 00:00:00 2001 2 | From: hluwa 3 | Date: Mon, 16 Aug 2021 10:55:11 +0800 4 | Subject: [PATCH 2/8] strongR-frida: io_re_frida_server 5 | 6 | --- 7 | server/server.vala | 3 ++- 8 | 1 file changed, 2 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/server/server.vala b/server/server.vala 11 | index e2d1b66d..42c86739 100644 12 | --- a/server/server.vala 13 | +++ b/server/server.vala 14 | @@ -1,7 +1,7 @@ 15 | namespace Frida.Server { 16 | private static Application application; 17 | 18 | - private const string DEFAULT_DIRECTORY = "re.frida.server"; 19 | + private static string DEFAULT_DIRECTORY = null; 20 | private static bool output_version = false; 21 | private static string? listen_address = null; 22 | private static string? certpath = null; 23 | @@ -50,6 +50,7 @@ namespace Frida.Server { 24 | }; 25 | 26 | private static int main (string[] args) { 27 | + DEFAULT_DIRECTORY = GLib.Uuid.string_random(); 28 | Environment.init (); 29 | 30 | #if DARWIN 31 | -- 32 | 2.30.2 33 | -------------------------------------------------------------------------------- /zer0def/frida-gum/0001-fixup-exact-gum-deps.patch: -------------------------------------------------------------------------------- 1 | #- "frida-il2cpp-bridge": "0.9.0" 2 | #+ "git+https://github.com/vfsfitvnm/frida-il2cpp-bridge": "v0.9.0" 3 | diff --git a/bindings/gumjs/generate-runtime.py b/bindings/gumjs/generate-runtime.py 4 | index 679cad56..5ef88c52 100644 5 | --- a/bindings/gumjs/generate-runtime.py 6 | +++ b/bindings/gumjs/generate-runtime.py 7 | @@ -14,9 +14,9 @@ RELAXED_DEPS = { 8 | } 9 | 10 | EXACT_DEPS = { 11 | - "frida-java-bridge": "6.3.5", 12 | - "frida-objc-bridge": "7.0.6", 13 | - "frida-swift-bridge": "2.0.8" 14 | + "git+https://github.com/frida/frida-java-bridge": "0495713823b95acc0ca6bc862f154ef4f5595aba", 15 | + "git+https://github.com/frida/frida-objc-bridge": "v7.0.6", 16 | + "git+https://github.com/frida/frida-swift-bridge": "v2.0.8" 17 | } 18 | 19 | 20 | @@ -52,7 +52,7 @@ def generate_runtime(output_dir, priv_dir, input_dir, gum_dir, capstone_incdir, 21 | capture_output=True, 22 | cwd=priv_dir, 23 | check=True) 24 | - subprocess.run([npm, "install", "-E"] + [f"{name}@{version_spec}" for name, version_spec in EXACT_DEPS.items()], 25 | + subprocess.run([npm, "install", "-E"] + [f"{name}#{version_spec}" for name, version_spec in EXACT_DEPS.items()], 26 | capture_output=True, 27 | cwd=priv_dir, 28 | check=True) 29 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0009-memory_str.patch: -------------------------------------------------------------------------------- 1 | From f35c3a4db13f885f5c9234cd1e68071377714f07 Mon Sep 17 00:00:00 2001 2 | From: Your Name 3 | Date: Tue, 14 Feb 2023 20:58:35 +0800 4 | Subject: [PATCH 10/11] memory_str 5 | 6 | --- 7 | src/anti-anti-frida.py | 10 ++++++++++ 8 | 1 file changed, 10 insertions(+) 9 | 10 | diff --git a/src/anti-anti-frida.py b/src/anti-anti-frida.py 11 | index aaff50ce..b990cf21 100644 12 | --- a/src/anti-anti-frida.py 13 | +++ b/src/anti-anti-frida.py 14 | @@ -27,6 +27,16 @@ if __name__ == "__main__": 15 | symbol.name = symbol.name.replace("frida", random_name) 16 | if "FRIDA" in symbol.name: 17 | symbol.name = symbol.name.replace("FRIDA", random_name) 18 | + 19 | + [ 20 | + ( 21 | + print(f"section={section.name} offset={hex(section.file_offset + addr)} {patch_str} -> {''.join(list(patch_str)[::-1])}"), 22 | + binary.patch_address(section.file_offset + addr, [ord(n) for n in list(patch_str)[::-1]]) # not sure if reversing a string can be considered sufficient 23 | + ) for section in binary.sections if section.name == ".rodata" 24 | + for patch_str in ["FridaScriptEngine", "GLib-GIO", "GDBusProxy", "GumScript"] # 字符串特征修改 尽量与源字符一样 25 | + for addr in section.search_all(patch_str) # Patch 内存字符串 26 | + ] 27 | + 28 | binary.write(input_file) 29 | 30 | for i in ["gum-js-loop", "gmain", "gdbus"]: 31 | -- 32 | 2.34.1 33 | 34 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0006-anti-anti-frida.py.patch: -------------------------------------------------------------------------------- 1 | From 65976afd602808c55a5d832f469cd4db245a8304 Mon Sep 17 00:00:00 2001 2 | From: heyang <375525827@qq.com> 3 | Date: Mon, 24 Oct 2022 15:41:12 +0800 4 | Subject: [PATCH 5/8] strongR-frida: symbol_frida_agent_main 5 | 6 | --- 7 | src/anti-anti-frida.py | 22 +++++++++++++++++++++ 8 | 1 files changed, 22 insertions(+) 9 | create mode 100644 src/anti-anti-frida.py 10 | 11 | diff --git a/src/anti-anti-frida.py b/src/anti-anti-frida.py 12 | new file mode 100644 13 | index 00000000..cc4e464d 14 | --- /dev/null 15 | +++ b/src/anti-anti-frida.py 16 | @@ -0,0 +1,22 @@ 17 | +#!/usr/bin/env python 18 | +import lief 19 | +import sys 20 | +import random 21 | +import string 22 | +import os 23 | +if __name__ == "__main__": 24 | + input_file = sys.argv[1] 25 | + print(f"[*] Patch frida-agent: {input_file}") 26 | + random_name = "".join(random.sample(string.ascii_uppercase+string.ascii_lowercase, 5)) 27 | + print(f"[*] Patch `frida` to `{random_name}``") 28 | + binary = lief.parse(input_file) 29 | + if not binary: 30 | + exit() 31 | + for symbol in binary.symbols: 32 | + if symbol.name == "frida_agent_main": 33 | + symbol.name = "main" 34 | + if "frida" in symbol.name: 35 | + symbol.name = symbol.name.replace("frida", random_name) 36 | + if "FRIDA" in symbol.name: 37 | + symbol.name = symbol.name.replace("FRIDA", random_name) 38 | + binary.write(input_file) 39 | \ No newline at end of file 40 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0001-string_frida_rpc.patch: -------------------------------------------------------------------------------- 1 | From 0874adb5e0e53d90da56e542053b9f14adccfb1a Mon Sep 17 00:00:00 2001 2 | From: hluwa 3 | Date: Mon, 16 Aug 2021 10:55:11 +0800 4 | Subject: [PATCH 1/8] strongR-frida: string_frida_rpc 5 | 6 | --- 7 | lib/base/rpc.vala | 6 +++--- 8 | 1 file changed, 3 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/lib/base/rpc.vala b/lib/base/rpc.vala 11 | index 3695ba8c..02602abf 100644 12 | --- a/lib/base/rpc.vala 13 | +++ b/lib/base/rpc.vala 14 | @@ -17,7 +17,7 @@ namespace Frida { 15 | var request = new Json.Builder (); 16 | request 17 | .begin_array () 18 | - .add_string_value ("frida:rpc") 19 | + .add_string_value ((string) GLib.Base64.decode("ZnJpZGE6cnBj")) 20 | .add_string_value (request_id) 21 | .add_string_value ("call") 22 | .add_string_value (method) 23 | @@ -70,7 +70,7 @@ namespace Frida { 24 | } 25 | 26 | public bool try_handle_message (string json) { 27 | - if (json.index_of ("\"frida:rpc\"") == -1) 28 | + if (json.index_of ((string) GLib.Base64.decode("ImZyaWRhOnJwYyI=")) == -1) 29 | return false; 30 | 31 | var parser = new Json.Parser (); 32 | @@ -99,7 +99,7 @@ namespace Frida { 33 | return false; 34 | 35 | string? type = rpc_message.get_element (0).get_string (); 36 | - if (type == null || type != "frida:rpc") 37 | + if (type == null || type != (string) GLib.Base64.decode("ZnJpZGE6cnBj")) 38 | return false; 39 | 40 | var request_id_value = rpc_message.get_element (1); 41 | -- 42 | 2.39.2 (Apple Git-143) 43 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0004-io_frida_agent_so.patch: -------------------------------------------------------------------------------- 1 | From 6fdcb5ae0b7f398e0eb2b23f22f9ab01ae2e09bf Mon Sep 17 00:00:00 2001 2 | From: hluwa 3 | Date: Mon, 16 Aug 2021 10:55:11 +0800 4 | Subject: [PATCH 4/8] strongR-frida: io_frida_agent_so 5 | 6 | --- 7 | src/linux/linux-host-session.vala | 7 ++++--- 8 | 1 file changed, 4 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/src/linux/linux-host-session.vala b/src/linux/linux-host-session.vala 11 | index 301799ed..059e75a9 100644 12 | --- a/src/linux/linux-host-session.vala 13 | +++ b/src/linux/linux-host-session.vala 14 | @@ -128,12 +128,13 @@ namespace Frida { 15 | var blob64 = Frida.Data.Agent.get_frida_agent_64_so_blob (); 16 | var emulated_arm = Frida.Data.Agent.get_frida_agent_arm_so_blob (); 17 | var emulated_arm64 = Frida.Data.Agent.get_frida_agent_arm64_so_blob (); 18 | - agent = new AgentDescriptor (PathTemplate ("frida-agent-.so"), 19 | + var random_prefix = GLib.Uuid.string_random(); 20 | + agent = new AgentDescriptor (PathTemplate (random_prefix + "-.so"), 21 | new Bytes.static (blob32.data), 22 | new Bytes.static (blob64.data), 23 | new AgentResource[] { 24 | - new AgentResource ("frida-agent-arm.so", new Bytes.static (emulated_arm.data), tempdir), 25 | - new AgentResource ("frida-agent-arm64.so", new Bytes.static (emulated_arm64.data), tempdir), 26 | + new AgentResource (random_prefix + "-arm.so", new Bytes.static (emulated_arm.data), tempdir), 27 | + new AgentResource (random_prefix + "-arm64.so", new Bytes.static (emulated_arm64.data), tempdir), 28 | }, 29 | AgentMode.INSTANCED, 30 | tempdir); 31 | -- 32 | 2.39.3 (Apple Git-145) 33 | 34 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0007-threads.patch: -------------------------------------------------------------------------------- 1 | From 52a435a7a1c7f4f45a6ec157ef6b237a50c2e342 Mon Sep 17 00:00:00 2001 2 | From: heyang <375525827@qq.com> 3 | Date: Mon, 24 Oct 2022 15:56:18 +0800 4 | Subject: [PATCH 6/8] strongR-frida: thread_gum_js_loop 5 | 6 | --- 7 | From 2d63299647f698b0c8d5c165c08edf1edf57b9dc Mon Sep 17 00:00:00 2001 8 | From: hluwa 9 | Date: Mon, 16 Aug 2021 10:55:11 +0800 10 | Subject: [PATCH 7/8] strongR-frida: thread_gmain 11 | 12 | --- 13 | From 55290725aa7102bee9482deea2673acda254cba6 Mon Sep 17 00:00:00 2001 14 | From: Your Name 15 | Date: Tue, 14 Feb 2023 20:57:34 +0800 16 | Subject: [PATCH 09/11] thread_gdbus 17 | 18 | --- 19 | src/anti-anti-frida.py | 7 ++++++- 20 | 1 file changed, 6 insertions(+), 1 deletion(-) 21 | 22 | diff --git a/src/anti-anti-frida.py b/src/anti-anti-frida.py 23 | index cc4e464d..9c22e35e 100644 24 | --- a/src/anti-anti-frida.py 25 | +++ b/src/anti-anti-frida.py 26 | @@ -18,4 +18,9 @@ if __name__ == "__main__": 27 | symbol.name = symbol.name.replace("frida", random_name) 28 | if "FRIDA" in symbol.name: 29 | symbol.name = symbol.name.replace("FRIDA", random_name) 30 | - binary.write(input_file) 31 | \ No newline at end of file 32 | + binary.write(input_file) 33 | + 34 | + for i in ["gum-js-loop", "gmain", "gdbus"]: # comprehension with walrus notation? needs py3.8, tho 35 | + random_name = "".join(random.sample(string.ascii_lowercase+string.ascii_uppercase, len(i))) 36 | + print(f"[*] Patch `{i}` to `{random_name}`") 37 | + os.system(f"sed -i s/{i}/{random_name}/g {input_file}") 38 | \ No newline at end of file 39 | -- 40 | 2.21.0 (Apple Git-122) 41 | 42 | -------------------------------------------------------------------------------- /fridare/frida-core/0001.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/anti-anti-frida.py b/src/anti-anti-frida.py 2 | index aaff50ce..b990cf21 100644 3 | --- a/src/anti-anti-frida.py 4 | +++ b/src/anti-anti-frida.py 5 | @@ -29,6 +29,28 @@ if __name__ == "__main__": 6 | for addr in section.search_all(patch_str) # Patch 内存字符串 7 | ] 8 | 9 | + [ 10 | + ( 11 | + print(f"section={section.name} offset={hex(section.file_offset + addr)} {patch_str} -> {random_name}{patch_str[5:]}"), 12 | + binary.patch_address(section.file_offset+addr, [ord(n) for n in random_name+patch_str[5:]]) 13 | + ) for section in binary.sections if section.name == ".rodata" 14 | + #for patch_str in ["frida_server_","frida-main-loop","frida:rpc","frida-agent-.so","frida-agent-arm.so","frida-agent-arm64.so","frida-agent-32.so","frida-agent-64.so"] 15 | + for patch_str in ["frida_server_","frida-main-loop","frida-agent-.so","frida-agent-arm.so","frida-agent-arm64.so","frida-agent-32.so","frida-agent-64.so"] 16 | + for addr in section.search_all(patch_str) 17 | + ] 18 | + #[ 19 | + # ( 20 | + # print(f"section={section.name} offset={hex(section.file_offset + addr)} frida:rpc -> {random_name}:rpc"), 21 | + # binary.patch_address(section.file_offset+addr, [ord(n) for n in random_name+":rpc"]) 22 | + # ) for section in binary.sections if section.name == ".text" for addr in section.search_all("frida:rpc") 23 | + #] 24 | + [ 25 | + ( 26 | + print(f"section={section.name} offset={hex(section.file_offset + addr)} gum- -> {random_name[:3]}-"), 27 | + binary.patch_address(section.file_offset+addr, [ord(n) for n in random_name[:3]+"-"]) 28 | + ) for section_name in [".rodata",".text"] for section in binary.sections 29 | + if section.name == section_name for addr in section.search_all("gum-") 30 | + ] 31 | + 32 | binary.write(input_file) 33 | 34 | for i in ["gum-js-loop", "gmain", "gdbus"]: # comprehension with walrus notation? needs py3.8, tho 35 | -------------------------------------------------------------------------------- /pyconfig.h-i686-x86_64.patch: -------------------------------------------------------------------------------- 1 | --- a/pyconfig.h 2015-03-13 13:11:55.000000000 +0100 2 | +++ b/pyconfig.h 2015-03-13 13:00:15.000000000 +0100 3 | @@ -309,14 +309,14 @@ 4 | #define HAVE_GAMMA 1 5 | 6 | /* Define if we can use x64 gcc inline assembler */ 7 | -/* #undef HAVE_GCC_ASM_FOR_X64 */ 8 | +#define HAVE_GCC_ASM_FOR_X64 1 9 | 10 | /* Define if we can use gcc inline assembler to get and set x87 control word 11 | */ 12 | #define HAVE_GCC_ASM_FOR_X87 1 13 | 14 | /* Define if your compiler provides __uint128_t */ 15 | -/* #undef HAVE_GCC_UINT128_T */ 16 | +#define HAVE_GCC_UINT128_T 1 17 | 18 | /* Define if you have the getaddrinfo function. */ 19 | #define HAVE_GETADDRINFO 1 20 | @@ -1210,10 +1210,10 @@ 21 | #define SIZEOF_INT 4 22 | 23 | /* The size of `long', as computed by sizeof. */ 24 | -#define SIZEOF_LONG 4 25 | +#define SIZEOF_LONG 8 26 | 27 | /* The size of `long double', as computed by sizeof. */ 28 | -#define SIZEOF_LONG_DOUBLE 12 29 | +#define SIZEOF_LONG_DOUBLE 16 30 | 31 | /* The size of `long long', as computed by sizeof. */ 32 | #define SIZEOF_LONG_LONG 8 33 | @@ -1225,22 +1225,22 @@ 34 | #define SIZEOF_PID_T 4 35 | 36 | /* The size of `pthread_t', as computed by sizeof. */ 37 | -#define SIZEOF_PTHREAD_T 4 38 | +#define SIZEOF_PTHREAD_T 8 39 | 40 | /* The size of `short', as computed by sizeof. */ 41 | #define SIZEOF_SHORT 2 42 | 43 | /* The size of `size_t', as computed by sizeof. */ 44 | -#define SIZEOF_SIZE_T 4 45 | +#define SIZEOF_SIZE_T 8 46 | 47 | /* The size of `time_t', as computed by sizeof. */ 48 | -#define SIZEOF_TIME_T 4 49 | +#define SIZEOF_TIME_T 8 50 | 51 | /* The size of `uintptr_t', as computed by sizeof. */ 52 | -#define SIZEOF_UINTPTR_T 4 53 | +#define SIZEOF_UINTPTR_T 8 54 | 55 | /* The size of `void *', as computed by sizeof. */ 56 | -#define SIZEOF_VOID_P 4 57 | +#define SIZEOF_VOID_P 8 58 | 59 | /* The size of `wchar_t', as computed by sizeof. */ 60 | #define SIZEOF_WCHAR_T 2 61 | @@ -1344,7 +1344,7 @@ 62 | #endif 63 | 64 | /* Define if arithmetic is subject to x87-style double rounding issue */ 65 | -#define X87_DOUBLE_ROUNDING 1 66 | +/* #undef X87_DOUBLE_ROUNDING */ 67 | 68 | /* Define on OpenBSD to activate all library features */ 69 | /* #undef _BSD_SOURCE */ 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Undetected Frida for Android 2 | 3 | This repo follows [FRIDA](https://github.com/frida/frida) upstream, auto-publishing the same version with some extra anti-detection patches applied. 4 | Releases right next door, on the side panel → 5 | 6 | ## State of the repository 7 | 8 | This repo holds a set of community-developed patches geared towards symptomatically attempting to make Frida barely less detectable by applications having lame counter-measures towards it, which I have tried to maintain as part of a hobby. 9 | 10 | Due to the amount of users incapable of distinguishing (or even passingly considering) whether bugs are caused by patches from this repository, upstream or themselves "just holding it wrong", the issue tracker is closed, as I ultimately hold no interest in repeatedly attempting to tell people how to correctly debug their issues or donating any form of support to this. 11 | 12 | Unless clearly stipulated otherwise elsewhere in ironclad legal writing applicable in the recepient's resident jurisdiction, the reader is never entitled to anyone else's time and effort other than their own, regardless of potential involvement of in-kind contribution. The fact this needs to be explicitly spelled out speaks for itself. 13 | 14 | However, constructive feedback is taken via pull request. 15 | 16 | With that said, one should never consider symptomatic substring-based detection or evasion as an exhaustive (or even definitive) measure. 17 | 18 | ## Patches 19 | 20 | |patchset|module|name| 21 | |-|-|-| 22 | |strongR-frida|frida-core|0001-string_frida_rpc.patch| 23 | |strongR-frida|frida-core|0002-io_re_frida_server.patch| 24 | |strongR-frida|frida-core|0003-pipe_linjector.patch| 25 | |strongR-frida|frida-core|0004-io_frida_agent_so.patch| 26 | |strongR-frida|frida-core|0005-symbol_frida_agent_main.patch| 27 | |strongR-frida|frida-core|0006-anti-anti-frida.py.patch| 28 | |strongR-frida|frida-core|0007-threads.patch| 29 | |strongR-frida|frida-core|0008-protocol_unexpected_command.patch| 30 | |strongR-frida|frida-core|0009-memory_str.patch| 31 | |florida|frida-core|0001-Florida-memfd-name-jit-cache.patch| 32 | |florida|frida-core|0002-Florida-pool-frida.patch| 33 | |florida|frida-gum|0001-Florida-pool-frida.patch| 34 | 35 | ## References 36 | 37 | - [https://github.com/feicong/strong-frida](https://github.com/feicong/strong-frida) 38 | - [https://github.com/qtfreet00/AntiFrida](https://github.com/qtfreet00/AntiFrida) 39 | - [https://t.zsxq.com/miIunQN](https://t.zsxq.com/miIunQN) 40 | - [https://github.com/darvincisec/DetectFrida](https://github.com/darvincisec/DetectFrida) 41 | - [https://github.com/b-mueller/frida-detection-demo](https://github.com/b-mueller/frida-detection-demo) 42 | - [https://bbs.kanxue.com/thread-276111.htm](https://bbs.kanxue.com/thread-276111.htm) 43 | - [https://github.com/CrackerCat/strongR-frida-android](https://github.com/CrackerCat/strongR-frida-android) 44 | - [https://github.com/hzzheyang/strongR-frida-android](https://github.com/hzzheyang/strongR-frida-android) 45 | - [https://github.com/AeonLucid/MagiskFrida](https://github.com/AeonLucid/MagiskFrida) 46 | - [https://github.com/Ylarod/Florida](https://github.com/Ylarod/Florida) 47 | - [https://github.com/thau0x01/frida-patches](https://github.com/thau0x01/frida-patches) 48 | - [https://github.com/soyasoya5/strongR-frida-patches](https://github.com/soyasoya5/strongR-frida-patches/tree/il2cpp_bridge_embed) 49 | - [https://github.com/Exo1i/MagiskHluda](https://github.com/Exo1i/MagiskHluda) 50 | 51 | ## Thanks 52 | 53 | - [@feicong](https://github.com/feicong) 54 | - [@r0ysue](https://github.com/r0ysue) 55 | - [@hellodword](https://github.com/hellodword) 56 | - [@qtfreet00](https://github.com/qtfreet00) 57 | - [@hzzheyang](https://github.com/hzzheyang) 58 | - [@CrackerCat](https://github.com/CrackerCat) 59 | - [@AeonLucid](https://github.com/AeonLucid) 60 | - [@Ylarod](https://github.com/Ylarod) 61 | - [@thau0x01](https://github.com/thau0x01) 62 | - [@Chensem](https://github.com/Chensem) 63 | - [@soyasoya5](https://github.com/soyasoya5) 64 | - [@Exo1i](https://github.com/Exo1i) 65 | - [@lico-n](https://github.com/lico-n) 66 | - [@Thiasap](https://github.com/Thiasap) 67 | - [@Rycoh99](https://github.com/Rycoh99) 68 | - [@elliott-wen](https://github.com/elliott-wen) 69 | -------------------------------------------------------------------------------- /magisk/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # Global vars 10 | TMPDIR=/dev/tmp 11 | PERSISTDIR=/sbin/.magisk/mirror/persist 12 | 13 | rm -rf $TMPDIR 2>/dev/null 14 | mkdir -p $TMPDIR 15 | 16 | # echo before loading util_functions 17 | ui_print() { echo "$1"; } 18 | 19 | require_new_magisk() { 20 | ui_print "*******************************" 21 | ui_print " Please install Magisk v19.0+! " 22 | ui_print "*******************************" 23 | exit 1 24 | } 25 | 26 | is_legacy_script() { 27 | unzip -l "$ZIPFILE" install.sh | grep -q install.sh 28 | return $? 29 | } 30 | 31 | print_modname() { 32 | local len 33 | len=`echo -n $MODNAME | wc -c` 34 | len=$((len + 2)) 35 | local pounds=`printf "%${len}s" | tr ' ' '*'` 36 | ui_print "$pounds" 37 | ui_print " $MODNAME " 38 | ui_print "$pounds" 39 | ui_print "*******************" 40 | ui_print " Powered by Magisk " 41 | ui_print "*******************" 42 | } 43 | 44 | ############## 45 | # Environment 46 | ############## 47 | 48 | OUTFD=$2 49 | ZIPFILE=$3 50 | 51 | mount /data 2>/dev/null 52 | 53 | # Load utility functions 54 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 55 | . /data/adb/magisk/util_functions.sh 56 | [ $MAGISK_VER_CODE -gt 18100 ] || require_new_magisk 57 | 58 | # Preperation for flashable zips 59 | setup_flashable 60 | 61 | # Mount partitions 62 | mount_partitions 63 | 64 | # Detect version and architecture 65 | api_level_arch_detect 66 | 67 | # Setup busybox and binaries 68 | $BOOTMODE && boot_actions || recovery_actions 69 | 70 | ############## 71 | # Preparation 72 | ############## 73 | 74 | # Extract prop file 75 | unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2 76 | [ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!" 77 | 78 | $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules 79 | MODULEROOT=$NVBASE/$MODDIRNAME 80 | MODID=`grep_prop id $TMPDIR/module.prop` 81 | MODPATH=$MODULEROOT/$MODID 82 | MODNAME=`grep_prop name $TMPDIR/module.prop` 83 | 84 | # Create mod paths 85 | rm -rf $MODPATH 2>/dev/null 86 | mkdir -p $MODPATH 87 | 88 | ########## 89 | # Install 90 | ########## 91 | 92 | if is_legacy_script; then 93 | unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2 94 | 95 | # Load install script 96 | . $TMPDIR/install.sh 97 | 98 | # Callbacks 99 | print_modname 100 | on_install 101 | 102 | # Custom uninstaller 103 | [ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh 104 | 105 | # Skip mount 106 | $SKIPMOUNT && touch $MODPATH/skip_mount 107 | 108 | # prop file 109 | $PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop 110 | 111 | # Module info 112 | cp -af $TMPDIR/module.prop $MODPATH/module.prop 113 | 114 | # post-fs-data scripts 115 | $POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh 116 | 117 | # service scripts 118 | $LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh 119 | 120 | ui_print "- Setting permissions" 121 | set_permissions 122 | else 123 | print_modname 124 | 125 | unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2 126 | 127 | if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then 128 | ui_print "- Extracting module files" 129 | unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2 130 | 131 | # Default permissions 132 | set_perm_recursive $MODPATH 0 0 0755 0644 133 | fi 134 | 135 | # Load customization script 136 | [ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh 137 | fi 138 | 139 | # Handle replace folders 140 | for TARGET in $REPLACE; do 141 | ui_print "- Replace target: $TARGET" 142 | mktouch $MODPATH$TARGET/.replace 143 | done 144 | 145 | if $BOOTMODE; then 146 | # Update info for Magisk Manager 147 | mktouch $NVBASE/modules/$MODID/update 148 | cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop 149 | fi 150 | 151 | # Copy over custom sepolicy rules 152 | if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then 153 | ui_print "- Installing custom sepolicy patch" 154 | PERSISTMOD=$PERSISTDIR/magisk/$MODID 155 | mkdir -p $PERSISTMOD 156 | cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule 157 | fi 158 | 159 | # Remove stuffs that don't belong to modules 160 | rm -rf \ 161 | $MODPATH/system/placeholder $MODPATH/customize.sh \ 162 | $MODPATH/README.md $MODPATH/.git* 2>/dev/null 163 | 164 | ############## 165 | # Finalizing 166 | ############## 167 | 168 | cd / 169 | $BOOTMODE || recovery_cleanup 170 | rm -rf $TMPDIR 171 | 172 | ui_print "- Done" 173 | exit 0 174 | -------------------------------------------------------------------------------- /strongR-frida/frida-core/0005-symbol_frida_agent_main.patch.deprecated: -------------------------------------------------------------------------------- 1 | From 65976afd602808c55a5d832f469cd4db245a8304 Mon Sep 17 00:00:00 2001 2 | From: heyang <375525827@qq.com> 3 | Date: Mon, 24 Oct 2022 15:41:12 +0800 4 | Subject: [PATCH 5/8] strongR-frida: symbol_frida_agent_main 5 | 6 | --- 7 | src/agent-container.vala | 2 +- 8 | src/darwin/darwin-host-session.vala | 2 +- 9 | src/freebsd/freebsd-host-session.vala | 2 +- 10 | src/linux/linux-host-session.vala | 2 +- 11 | src/qnx/qnx-host-session.vala | 2 +- 12 | src/windows/windows-host-session.vala | 2 +- 13 | tests/test-agent.vala | 2 +- 14 | tests/test-injector.vala | 2 +- 15 | 8 files changed, 8 insertions(+), 8 deletions(-) 16 | 17 | diff --git a/src/agent-container.vala b/src/agent-container.vala 18 | index a8db6b29..4a02a823 100644 19 | --- a/src/agent-container.vala 20 | +++ b/src/agent-container.vala 21 | @@ -25,7 +25,7 @@ namespace Frida { 22 | assert (container.module != null); 23 | 24 | void * main_func_symbol; 25 | - var main_func_found = container.module.symbol ("frida_agent_main", out main_func_symbol); 26 | + var main_func_found = container.module.symbol ("main", out main_func_symbol); 27 | assert (main_func_found); 28 | container.main_impl = (AgentMainFunc) main_func_symbol; 29 | 30 | diff --git a/src/darwin/darwin-host-session.vala b/src/darwin/darwin-host-session.vala 31 | index 2e9c010b..ddc7f023 100644 32 | --- a/src/darwin/darwin-host-session.vala 33 | +++ b/src/darwin/darwin-host-session.vala 34 | @@ -354,7 +354,7 @@ namespace Frida { 35 | private async uint inject_agent (uint pid, string agent_parameters, Cancellable? cancellable) throws Error, IOError { 36 | uint id; 37 | 38 | - unowned string entrypoint = "frida_agent_main"; 39 | + unowned string entrypoint = "main"; 40 | #if HAVE_EMBEDDED_ASSETS 41 | id = yield fruitjector.inject_library_resource (pid, agent, entrypoint, agent_parameters, cancellable); 42 | #else 43 | diff --git a/src/freebsd/freebsd-host-session.vala b/src/freebsd/freebsd-host-session.vala 44 | index a2204a4e..c84bb9bf 100644 45 | --- a/src/freebsd/freebsd-host-session.vala 46 | +++ b/src/freebsd/freebsd-host-session.vala 47 | @@ -197,7 +197,7 @@ namespace Frida { 48 | 49 | var stream_request = Pipe.open (t.local_address, cancellable); 50 | 51 | - var id = yield binjector.inject_library_resource (pid, agent_desc, "frida_agent_main", 52 | + var id = yield binjector.inject_library_resource (pid, agent_desc, "main", 53 | make_agent_parameters (pid, t.remote_address, options), cancellable); 54 | injectee_by_pid[pid] = id; 55 | 56 | diff --git a/src/linux/linux-host-session.vala b/src/linux/linux-host-session.vala 57 | index 052a63b6..0ead0c29 100644 58 | --- a/src/linux/linux-host-session.vala 59 | +++ b/src/linux/linux-host-session.vala 60 | @@ -426,7 +426,7 @@ namespace Frida { 61 | protected override async Future perform_attach_to (uint pid, HashTable options, 62 | Cancellable? cancellable, out Object? transport) throws Error, IOError { 63 | uint id; 64 | - string entrypoint = "frida_agent_main"; 65 | + string entrypoint = "main"; 66 | string parameters = make_agent_parameters (pid, "", options); 67 | AgentFeatures features = CONTROL_CHANNEL; 68 | var linjector = (Linjector) injector; 69 | diff --git a/src/qnx/qnx-host-session.vala b/src/qnx/qnx-host-session.vala 70 | index 69f2995f..5a94427d 100644 71 | --- a/src/qnx/qnx-host-session.vala 72 | +++ b/src/qnx/qnx-host-session.vala 73 | @@ -182,7 +182,7 @@ namespace Frida { 74 | 75 | var stream_request = Pipe.open (t.local_address, cancellable); 76 | 77 | - var id = yield qinjector.inject_library_resource (pid, agent_desc, "frida_agent_main", 78 | + var id = yield qinjector.inject_library_resource (pid, agent_desc, "main", 79 | make_agent_parameters (pid, t.remote_address, options), cancellable); 80 | injectee_by_pid[pid] = id; 81 | 82 | diff --git a/src/windows/windows-host-session.vala b/src/windows/windows-host-session.vala 83 | index 67f1f3ef..a1776df1 100644 84 | --- a/src/windows/windows-host-session.vala 85 | +++ b/src/windows/windows-host-session.vala 86 | @@ -274,7 +274,7 @@ namespace Frida { 87 | var stream_request = Pipe.open (t.local_address, cancellable); 88 | 89 | var winjector = injector as Winjector; 90 | - var id = yield winjector.inject_library_resource (pid, agent, "frida_agent_main", 91 | + var id = yield winjector.inject_library_resource (pid, agent, "main", 92 | make_agent_parameters (pid, t.remote_address, options), cancellable); 93 | injectee_by_pid[pid] = id; 94 | 95 | diff --git a/tests/test-agent.vala b/tests/test-agent.vala 96 | index 10bb0806..6ee7c54f 100644 97 | --- a/tests/test-agent.vala 98 | +++ b/tests/test-agent.vala 99 | @@ -449,7 +449,7 @@ Interceptor.attach(Module.getExportByName('libsystem_kernel.dylib', 'open'), () 100 | assert_nonnull (module); 101 | 102 | void * main_func_symbol; 103 | - var main_func_found = module.symbol ("frida_agent_main", out main_func_symbol); 104 | + var main_func_found = module.symbol ("main", out main_func_symbol); 105 | assert_true (main_func_found); 106 | main_impl = (AgentMainFunc) main_func_symbol; 107 | 108 | diff --git a/tests/test-injector.vala b/tests/test-injector.vala 109 | index fb1facaf..3f18d2a3 100644 110 | --- a/tests/test-injector.vala 111 | +++ b/tests/test-injector.vala 112 | @@ -257,7 +257,7 @@ namespace Frida.InjectorTest { 113 | var path = Frida.Test.Labrats.path_to_library (name, arch); 114 | assert_true (FileUtils.test (path, FileTest.EXISTS)); 115 | 116 | - yield injector.inject_library_file (process.id, path, "frida_agent_main", data); 117 | + yield injector.inject_library_file (process.id, path, "main", data); 118 | } catch (GLib.Error e) { 119 | printerr ("\nFAIL: %s\n\n", e.message); 120 | assert_not_reached (); 121 | -- 122 | 2.39.2 (Apple Git-143) 123 | -------------------------------------------------------------------------------- /magisk/install.sh: -------------------------------------------------------------------------------- 1 | ########################################################################################## 2 | # 3 | # Magisk Module Installer Script 4 | # 5 | ########################################################################################## 6 | ########################################################################################## 7 | # 8 | # Instructions: 9 | # 10 | # 1. Place your files into system folder (delete the placeholder file) 11 | # 2. Fill in your module's info into module.prop 12 | # 3. Configure and implement callbacks in this file 13 | # 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh 14 | # 5. Add your additional or modified system properties into common/system.prop 15 | # 16 | ########################################################################################## 17 | 18 | ########################################################################################## 19 | # Config Flags 20 | ########################################################################################## 21 | 22 | # Set to true if you do *NOT* want Magisk to mount 23 | # any files for you. Most modules would NOT want 24 | # to set this flag to true 25 | SKIPMOUNT=false 26 | 27 | # Set to true if you need to load system.prop 28 | PROPFILE=false 29 | 30 | # Set to true if you need post-fs-data script 31 | POSTFSDATA=false 32 | 33 | # Set to true if you need late_start service script 34 | LATESTARTSERVICE=true 35 | 36 | ########################################################################################## 37 | # Replace list 38 | ########################################################################################## 39 | 40 | # List all directories you want to directly replace in the system 41 | # Check the documentations for more info why you would need this 42 | 43 | # Construct your list in the following format 44 | # This is an example 45 | REPLACE_EXAMPLE=" 46 | /system/app/Youtube 47 | /system/priv-app/SystemUI 48 | /system/priv-app/Settings 49 | /system/framework 50 | " 51 | 52 | # Construct your own list here 53 | REPLACE=" 54 | " 55 | 56 | ########################################################################################## 57 | # 58 | # Function Callbacks 59 | # 60 | # The following functions will be called by the installation framework. 61 | # You do not have the ability to modify update-binary, the only way you can customize 62 | # installation is through implementing these functions. 63 | # 64 | # When running your callbacks, the installation framework will make sure the Magisk 65 | # internal busybox path is *PREPENDED* to PATH, so all common commands shall exist. 66 | # Also, it will make sure /data, /system, and /vendor is properly mounted. 67 | # 68 | ########################################################################################## 69 | ########################################################################################## 70 | # 71 | # The installation framework will export some variables and functions. 72 | # You should use these variables and functions for installation. 73 | # 74 | # ! DO NOT use any Magisk internal paths as those are NOT public API. 75 | # ! DO NOT use other functions in util_functions.sh as they are NOT public API. 76 | # ! Non public APIs are not guranteed to maintain compatibility between releases. 77 | # 78 | # Available variables: 79 | # 80 | # MAGISK_VER (string): the version string of current installed Magisk 81 | # MAGISK_VER_CODE (int): the version code of current installed Magisk 82 | # BOOTMODE (bool): true if the module is currently installing in Magisk Manager 83 | # MODPATH (path): the path where your module files should be installed 84 | # TMPDIR (path): a place where you can temporarily store files 85 | # ZIPFILE (path): your module's installation zip 86 | # ARCH (string): the architecture of the device. Value is either arm, arm64, x86, or x64 87 | # IS64BIT (bool): true if $ARCH is either arm64 or x64 88 | # API (int): the API level (Android version) of the device 89 | # 90 | # Availible functions: 91 | # 92 | # ui_print 93 | # print to console 94 | # Avoid using 'echo' as it will not display in custom recovery's console 95 | # 96 | # abort 97 | # print error message to console and terminate installation 98 | # Avoid using 'exit' as it will skip the termination cleanup steps 99 | # 100 | # set_perm [context] 101 | # if [context] is empty, it will default to "u:object_r:system_file:s0" 102 | # this function is a shorthand for the following commands 103 | # chown owner.group target 104 | # chmod permission target 105 | # chcon context target 106 | # 107 | # set_perm_recursive [context] 108 | # if [context] is empty, it will default to "u:object_r:system_file:s0" 109 | # for all files in , it will call: 110 | # set_perm file owner group filepermission context 111 | # for all directories in (including itself), it will call: 112 | # set_perm dir owner group dirpermission context 113 | # 114 | ########################################################################################## 115 | ########################################################################################## 116 | # If you need boot scripts, DO NOT use general boot scripts (post-fs-data.d/service.d) 117 | # ONLY use module scripts as it respects the module status (remove/disable) and is 118 | # guaranteed to maintain the same behavior in future Magisk releases. 119 | # Enable boot scripts by setting the flags in the config section above. 120 | ########################################################################################## 121 | 122 | # Set what you want to display when installing your module 123 | 124 | [ "${MODPATH#/data/adb}" != "${MODPATH}" ] || MODPATH="/data/adb${MODPATH}" 125 | _TARGETDIR="${MODPATH}/system/bin" 126 | print_modname() { 127 | ui_print " " 128 | ui_print " ********************" 129 | ui_print " * Undetected Frida *" 130 | ui_print " ********************" 131 | ui_print " " 132 | } 133 | 134 | # Copy/extract your module files into $MODPATH in on_install. 135 | on_install() { 136 | case "${ARCH}" in 137 | arm64|arm|x86) _ARCH="${ARCH}";; 138 | x64) _ARCH=x86_64;; 139 | *) ui_print "Unsupported architecture: ${ARCH}"; abort;; 140 | esac 141 | 142 | ui_print "- Detected architecture: ${_ARCH}" 143 | ui_print "- Extracting module files" 144 | 145 | mkdir -p "${_TARGETDIR}" 146 | /data/adb/magisk/busybox unzip -qq -o "${ZIPFILE}" "files/frida-server-${_ARCH}" -j -d "${_TARGETDIR}" 147 | mv "${_TARGETDIR}/frida-server-${_ARCH}" "${_TARGETDIR}/com.android.systemui" 148 | } 149 | 150 | # Only some special files require specific permissions 151 | # This function will be called after on_install is done 152 | # The default permissions should be good enough for most cases 153 | 154 | set_permissions() { 155 | # The following is the default rule, DO NOT remove 156 | set_perm_recursive "${MODPATH}" 0 0 0755 0644 157 | 158 | # Custom permissions 159 | set_perm "${_TARGETDIR}/com.android.systemui" 0 2000 0755 u:object_r:system_file:s0 160 | } 161 | 162 | # You can add more functions to assist your custom script code 163 | -------------------------------------------------------------------------------- /soyasoya5/frida-gum/0001-il2cpp.patch: -------------------------------------------------------------------------------- 1 | # Author: Chensem 2 | # Profile: https://github.com/Chensem 3 | diff --git a/bindings/gumjs/generate-runtime.py b/bindings/gumjs/generate-runtime.py 4 | index 75951b2f..2df61037 100755 5 | --- a/bindings/gumjs/generate-runtime.py 6 | +++ b/bindings/gumjs/generate-runtime.py 7 | @@ -18,7 +18,8 @@ RELAXED_DEPS = { 8 | EXACT_DEPS = { 9 | "frida-java-bridge": "6.3.5", 10 | "frida-objc-bridge": "7.0.6", 11 | - "frida-swift-bridge": "2.0.8" 12 | + "frida-swift-bridge": "2.0.8", 13 | + "frida-il2cpp-bridge": "0.9.0" 14 | } 15 | 16 | 17 | @@ -77,6 +78,7 @@ def generate_runtime(backends, arch, endian, input_dir, gum_dir, capstone_incdir 18 | objc = quick_tmp_dir / "objc.js" 19 | swift = quick_tmp_dir / "swift.js" 20 | java = quick_tmp_dir / "java.js" 21 | + il2cpp = quick_tmp_dir / "il2cpp.js" 22 | 23 | quick_options = [ 24 | "-c", # Compress for smaller code and better performance. 25 | @@ -85,6 +87,7 @@ def generate_runtime(backends, arch, endian, input_dir, gum_dir, capstone_incdir 26 | call_compiler(runtime_reldir / "objc.js", "-o", objc, *quick_options) 27 | call_compiler(runtime_reldir / "swift.js", "-o", swift, *quick_options) 28 | call_compiler(runtime_reldir / "java.js", "-o", java, *quick_options) 29 | + call_compiler(runtime_reldir / "il2cpp.js", "-o", il2cpp, *quick_options) 30 | 31 | qcflags = [] 32 | if endian != sys.byteorder: 33 | @@ -94,6 +98,8 @@ def generate_runtime(backends, arch, endian, input_dir, gum_dir, capstone_incdir 34 | generate_runtime_quick("objc", output_dir, priv_dir, "gumquickscript-objc.h", [objc], quickcompile, qcflags) 35 | generate_runtime_quick("swift", output_dir, priv_dir, "gumquickscript-swift.h", [swift], quickcompile, qcflags) 36 | generate_runtime_quick("java", output_dir, priv_dir, "gumquickscript-java.h", [java], quickcompile, qcflags) 37 | + generate_runtime_quick("il2cpp", output_dir, priv_dir, "gumquickscript-il2cpp.h", [il2cpp], quickcompile, qcflags) 38 | + 39 | 40 | 41 | if "v8" in backends: 42 | @@ -102,6 +108,8 @@ def generate_runtime(backends, arch, endian, input_dir, gum_dir, capstone_incdir 43 | objc = v8_tmp_dir / "objc.js" 44 | swift = v8_tmp_dir / "swift.js" 45 | java = v8_tmp_dir / "java.js" 46 | + il2cpp = v8_tmp_dir / "il2cpp.js" 47 | + 48 | 49 | v8_options = [ 50 | "-c", # Compress for smaller code and better performance. 51 | @@ -110,11 +118,13 @@ def generate_runtime(backends, arch, endian, input_dir, gum_dir, capstone_incdir 52 | call_compiler(runtime_reldir / "objc.js", "-o", objc, *v8_options) 53 | call_compiler(runtime_reldir / "swift.js", "-o", swift, *v8_options) 54 | call_compiler(runtime_reldir / "java.js", "-o", java, *v8_options) 55 | + call_compiler(runtime_reldir / "il2cpp.js", "-o", il2cpp, *v8_options) 56 | 57 | generate_runtime_v8("runtime", output_dir, priv_dir, "gumv8script-runtime.h", [runtime]) 58 | generate_runtime_v8("objc", output_dir, priv_dir, "gumv8script-objc.h", [objc]) 59 | generate_runtime_v8("swift", output_dir, priv_dir, "gumv8script-swift.h", [swift]) 60 | generate_runtime_v8("java", output_dir, priv_dir, "gumv8script-java.h", [java]) 61 | + generate_runtime_v8("il2cpp", output_dir, priv_dir, "gumv8script-il2cpp.h", [il2cpp]) 62 | 63 | generate_runtime_cmodule(output_dir, "gumcmodule-runtime.h", arch, input_dir, gum_dir, capstone_incdir, libtcc_incdir) 64 | 65 | diff --git a/bindings/gumjs/gumquickcore.c b/bindings/gumjs/gumquickcore.c 66 | index 8e1fe980..eb46ea25 100644 67 | --- a/bindings/gumjs/gumquickcore.c 68 | +++ b/bindings/gumjs/gumquickcore.c 69 | @@ -24,6 +24,9 @@ 70 | #ifdef HAVE_JAVA_BRIDGE 71 | # include "gumquickscript-java.h" 72 | #endif 73 | +#ifdef HAVE_IL2CPP_BRIDGE 74 | +# include "gumquickscript-il2cpp.h" 75 | +#endif 76 | 77 | #include 78 | #ifdef _MSC_VER 79 | @@ -169,6 +172,8 @@ GUMJS_DECLARE_GETTER (gumjs_frida_get_heap_size) 80 | GUMJS_DECLARE_FUNCTION (gumjs_frida_objc_load) 81 | GUMJS_DECLARE_FUNCTION (gumjs_frida_swift_load) 82 | GUMJS_DECLARE_FUNCTION (gumjs_frida_java_load) 83 | +GUMJS_DECLARE_FUNCTION (gumjs_frida_il2cpp_load) 84 | + 85 | 86 | GUMJS_DECLARE_FUNCTION (gumjs_script_evaluate) 87 | GUMJS_DECLARE_FUNCTION (gumjs_script_load) 88 | @@ -384,6 +389,8 @@ static const JSCFunctionListEntry gumjs_frida_entries[] = 89 | JS_CFUNC_DEF ("_loadObjC", 0, gumjs_frida_objc_load), 90 | JS_CFUNC_DEF ("_loadSwift", 0, gumjs_frida_swift_load), 91 | JS_CFUNC_DEF ("_loadJava", 0, gumjs_frida_java_load), 92 | + JS_CFUNC_DEF ("_loadIl2Cpp", 0, gumjs_frida_il2cpp_load), 93 | + 94 | }; 95 | 96 | static const JSCFunctionListEntry gumjs_script_entries[] = 97 | @@ -2021,6 +2028,19 @@ GUMJS_DEFINE_FUNCTION (gumjs_frida_java_load) 98 | return loaded; 99 | } 100 | 101 | +GUMJS_DEFINE_FUNCTION (gumjs_frida_il2cpp_load) 102 | +{ 103 | + JSValue loaded = JS_FALSE; 104 | + 105 | +#ifdef HAVE_IL2CPP_BRIDGE 106 | + gum_quick_bundle_load (gumjs_il2cpp_modules, ctx); 107 | + loaded = JS_TRUE; 108 | +#endif 109 | + 110 | + return loaded; 111 | +} 112 | + 113 | + 114 | GUMJS_DEFINE_FUNCTION (gumjs_script_evaluate) 115 | { 116 | const gchar * name, * source; 117 | @@ -2174,6 +2194,12 @@ GUMJS_DEFINE_FUNCTION (gumjs_script_find_source_map) 118 | { 119 | json = gumjs_java_source_map; 120 | } 121 | +#endif 122 | +#ifdef HAVE_IL2CPP_BRIDGE 123 | + else if (strcmp (name, "/_il2cppjs") == 0) 124 | + { 125 | + json = gumjs_il2cpp_source_map; 126 | + } 127 | #endif 128 | } 129 | 130 | diff --git a/bindings/gumjs/gumv8core.cpp b/bindings/gumjs/gumv8core.cpp 131 | index 1c9d3f44..a898acc1 100644 132 | --- a/bindings/gumjs/gumv8core.cpp 133 | +++ b/bindings/gumjs/gumv8core.cpp 134 | @@ -25,6 +25,10 @@ 135 | #ifdef HAVE_JAVA_BRIDGE 136 | # include "gumv8script-java.h" 137 | #endif 138 | +#ifdef HAVE_IL2CPP_BRIDGE 139 | +# include "gumv8script-il2cpp.h" 140 | +#endif 141 | + 142 | 143 | #include 144 | #ifdef _MSC_VER 145 | @@ -191,6 +195,7 @@ GUMJS_DECLARE_GETTER (gumjs_frida_get_heap_size) 146 | GUMJS_DECLARE_FUNCTION (gumjs_frida_objc_load) 147 | GUMJS_DECLARE_FUNCTION (gumjs_frida_swift_load) 148 | GUMJS_DECLARE_FUNCTION (gumjs_frida_java_load) 149 | +GUMJS_DECLARE_FUNCTION (gumjs_frida_il2cpp_load) 150 | 151 | GUMJS_DECLARE_FUNCTION (gumjs_script_evaluate) 152 | GUMJS_DECLARE_FUNCTION (gumjs_script_load) 153 | @@ -389,6 +394,8 @@ static const GumV8Function gumjs_frida_functions[] = 154 | { "_loadObjC", gumjs_frida_objc_load }, 155 | { "_loadSwift", gumjs_frida_swift_load }, 156 | { "_loadJava", gumjs_frida_java_load }, 157 | + { "_loadIl2Cpp", gumjs_frida_il2cpp_load }, 158 | + 159 | 160 | { NULL, NULL } 161 | }; 162 | @@ -1681,6 +1688,21 @@ GUMJS_DEFINE_FUNCTION (gumjs_frida_java_load) 163 | info.GetReturnValue ().Set (loaded); 164 | } 165 | 166 | +GUMJS_DEFINE_FUNCTION (gumjs_frida_il2cpp_load) 167 | +{ 168 | + bool loaded = false; 169 | + 170 | +#ifdef HAVE_IL2CPP_BRIDGE 171 | + auto bundle = gum_v8_bundle_new (isolate, gumjs_il2cpp_modules); 172 | + gum_v8_bundle_run (bundle); 173 | + gum_v8_bundle_free (bundle); 174 | + 175 | + loaded = true; 176 | +#endif 177 | + 178 | + info.GetReturnValue ().Set (loaded); 179 | +} 180 | + 181 | GUMJS_DEFINE_FUNCTION (gumjs_script_evaluate) 182 | { 183 | gchar * name, * source; 184 | @@ -1815,6 +1837,12 @@ GUMJS_DEFINE_FUNCTION (gumjs_script_find_source_map) 185 | { 186 | json = gumjs_java_source_map; 187 | } 188 | +#endif 189 | +#ifdef HAVE_IL2CPP_BRIDGE 190 | + else if (strcmp (name, "/_il2cpp.js") == 0) 191 | + { 192 | + json = gumjs_il2cpp_source_map; 193 | + } 194 | #endif 195 | } 196 | } 197 | diff --git a/bindings/gumjs/meson.build b/bindings/gumjs/meson.build 198 | index f4d9f85f..c16f9ee5 100644 199 | --- a/bindings/gumjs/meson.build 200 | +++ b/bindings/gumjs/meson.build 201 | @@ -258,6 +258,7 @@ gumjs_deps = [ 202 | 203 | gumjs = library('frida-gumjs-' + api_version, gumjs_sources, 204 | c_args: frida_component_cflags, 205 | + cpp_args: ['-funsigned-char'], 206 | override_options: [ 207 | 'cpp_std=c++17', 208 | 'cpp_eh=none', 209 | diff --git a/bindings/gumjs/runtime/core.js b/bindings/gumjs/runtime/core.js 210 | index cdabc715..e03a40db 100644 211 | --- a/bindings/gumjs/runtime/core.js 212 | +++ b/bindings/gumjs/runtime/core.js 213 | @@ -147,6 +147,8 @@ Object.defineProperties(engine, { 214 | }, 215 | }); 216 | 217 | +Frida._loadIl2Cpp() 218 | + 219 | function makeStubBridge() { 220 | return Object.freeze({ available: false }); 221 | } 222 | diff --git a/meson.build b/meson.build 223 | index 43ba4ff3..4f6c02fb 100644 224 | --- a/meson.build 225 | +++ b/meson.build 226 | @@ -48,7 +48,9 @@ endif 227 | 228 | cc = meson.get_compiler('c') 229 | 230 | -frida_component_cflags = [] 231 | +frida_component_cflags = [ 232 | + '-funsigned-char' 233 | +] 234 | ndebug = get_option('b_ndebug') 235 | optimize_for_prod = ndebug == 'true' or (ndebug == 'if-release' and not get_option('debug')) 236 | if optimize_for_prod 237 | @@ -572,6 +574,10 @@ if have_gumjs 238 | cdata.set('HAVE_JAVA_BRIDGE', 1) 239 | endif 240 | 241 | + if get_option('frida_il2cpp_bridge').allowed() 242 | + cdata.set('HAVE_IL2CPP_BRIDGE', 1) 243 | + endif 244 | + 245 | libsoup_dep = dependency('libsoup-3.0', default_options: [ 246 | 'gssapi=disabled', 247 | 'ntlm=disabled', 248 | @@ -644,6 +650,7 @@ install_header_subdir = install_header_basedir + '/gum' 249 | 250 | subdir('ext') 251 | subdir('gum') 252 | + 253 | if not diet 254 | subdir('libs') 255 | subdir('bindings') 256 | @@ -656,3 +663,5 @@ endif 257 | if build_tests 258 | subdir('tests') 259 | endif 260 | + 261 | + 262 | diff --git a/meson.options b/meson.options 263 | index 30cfb599..e45ce0a2 100644 264 | --- a/meson.options 265 | +++ b/meson.options 266 | @@ -65,6 +65,12 @@ option('frida_java_bridge', 267 | description: 'Build JavaScript bindings with Java bridge included' 268 | ) 269 | 270 | +option('frida_il2cpp_bridge', 271 | + type: 'feature', 272 | + value: 'auto', 273 | + description: 'Build JavaScript bindings with Il2Cpp bridge included' 274 | +) 275 | + 276 | option('tests', 277 | type: 'feature', 278 | value: 'auto', 279 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: undetected-frida 2 | 3 | on: 4 | schedule: 5 | - cron: "0 9/12 * * *" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | check: 10 | runs-on: ubuntu-22.04 11 | steps: 12 | - name: Check for existing release 13 | id: check 14 | run: | 15 | frida_version="$(curl -fs https://api.github.com/repos/frida/frida/releases | jq -r .[].tag_name | sort -nr | head -n1)" 16 | frida_version="$(curl -fs https://api.github.com/repos/frida/frida/releases/latest | jq -r .tag_name)" 17 | echo "FRIDA_VERSION=${frida_version}" >> "${GITHUB_OUTPUT}" # gh env? 18 | 19 | release_exists=0 20 | set +e 21 | curl -fso /dev/null "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${frida_version}" 22 | [ "${?}" -ne 0 ] || release_exists=1 23 | echo "RELEASE_EXISTS=${release_exists}" >> "${GITHUB_OUTPUT}" 24 | outputs: 25 | FRIDA_VERSION: ${{ steps.check.outputs.FRIDA_VERSION }} 26 | RELEASE_EXISTS: ${{ steps.check.outputs.RELEASE_EXISTS }} 27 | 28 | create: 29 | runs-on: ubuntu-22.04 30 | needs: 31 | - check 32 | if: needs.check.outputs.RELEASE_EXISTS == '0' 33 | steps: 34 | - name: Create release 35 | id: create 36 | env: 37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 38 | run: | 39 | # might need to use bash arrays for adequate DRY quotation? 40 | curl_args="-fs -H 'Authorization: token ${GITHUB_TOKEN}'" 41 | api_args="${curl_args} -H 'Content-Type: application/json' -d@-" 42 | upload_args="${curl_args} -H 'Content-Type: application/octet-stream' -o /dev/null --data-binary @-" # cat | curl --data-binary 43 | 44 | tmpfile="$(mktemp)" # a bit excessive, but eh 45 | echo '{"tag_name":"${{ needs.check.outputs.FRIDA_VERSION }}","name":"${{ needs.check.outputs.FRIDA_VERSION }}","body":"${{ needs.check.outputs.FRIDA_VERSION }}","draft":true}' | curl -fs -H "Authorization: token ${GITHUB_TOKEN}" -H "Content-Type: application/json" -d@- "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" >"${tmpfile}" 46 | 47 | echo "RELEASE_ID=$(jq -r .id "${tmpfile}")" >> "${GITHUB_OUTPUT}" 48 | #echo "UPLOAD_URL=$(jq -r .upload_url "${tmpfile}")" >> "${GITHUB_OUTPUT}" 49 | outputs: 50 | RELEASE_ID: ${{ steps.create.outputs.RELEASE_ID }} 51 | 52 | build: 53 | runs-on: ubuntu-22.04 54 | needs: 55 | - check 56 | - create 57 | if: needs.check.outputs.RELEASE_EXISTS == '0' 58 | strategy: 59 | matrix: 60 | arch: 61 | - arm64 62 | - arm 63 | - x86_64 64 | - x86 65 | #bin: ["server", "inject"] 66 | #devkit: ["core", "gum", "gumjs"] 67 | os: 68 | - android 69 | #target: ["core", "gum"] 70 | steps: 71 | - uses: actions/checkout@v4 72 | 73 | - name: Node 18 setup 74 | uses: actions/setup-node@v4 75 | with: 76 | node-version: 18 77 | 78 | - name: JDK 8 setup 79 | uses: actions/setup-java@v4 80 | with: 81 | java-version: "8" 82 | distribution: temurin 83 | 84 | - name: Python 3.12 setup 85 | uses: actions/setup-python@v5 86 | with: 87 | python-version: '3.12' 88 | 89 | - name: NDK 25c setup 90 | run: | 91 | curl -sSLO https://dl.google.com/android/repository/android-ndk-r25c-linux.zip 92 | [ "$(sha1sum android-ndk-r25c-linux.zip | awk '{print $1}')" = "53af80a1cce9144025b81c78c8cd556bff42bd0e" ] || exit 1 93 | unzip -qo android-ndk-r25c-linux.zip; rm android-ndk-r25c-linux.zip; 94 | rm -rf "${ANDROID_NDK%/*}/25.2.9519653"; mv -v android-ndk-r25c "${ANDROID_NDK%/*}/25.2.9519653"; export ANDROID_NDK="${ANDROID_NDK%/*}/25.2.9519653" 95 | export ANDROID_NDK_HOME="${ANDROID_NDK}" ANDROID_NDK_ROOT="${ANDROID_NDK}" ANDROID_NDK_LATEST_HOME="${ANDROID_NDK}" 96 | 97 | - name: Install dependencies 98 | run: | 99 | [ $(id -u) -eq 0 ] || SUDO=sudo 100 | ${SUDO} apt-get update && DEBIAN_FRONTEND=noninteractive ${SUDO} apt-get install -y build-essential ninja-build gcc-multilib g++-multilib lib32stdc++-9-dev flex bison libc6-dev libc6-dev-i386 xz-utils plzip zstd pigz gettext-base # upx tree 101 | ${SUDO} /opt/hostedtoolcache/Python/3.12.*/x64/bin/pip3 install -U setuptools lief 102 | 103 | _CARCH="${{ matrix.arch }}"; if [ "${_CARCH%64}" = "${_CARCH}" ]; then # && bit_width=32 || bit_width=64 104 | pushd /opt/hostedtoolcache/Python/3.12.*/x64/include/python3.12; patch -Rp1 <${{ github.workspace }}/pyconfig.h-i686-x86_64.patch; popd 105 | fi 106 | 107 | - name: Build Frida 108 | run: | 109 | export ANDROID_NDK="${ANDROID_NDK%/*}/25.2.9519653"; export ANDROID_NDK_HOME="${ANDROID_NDK}" ANDROID_NDK_ROOT="${ANDROID_NDK}" ANDROID_NDK_LATEST_HOME="${ANDROID_NDK}" 110 | FRIDA_VERSION="${{ needs.check.outputs.FRIDA_VERSION }}" 111 | git clone --recurse-submodules https://github.com/frida/frida -b "${FRIDA_VERSION}"; pushd frida 112 | 113 | set +e 114 | FRIDA_PREFIX="$(tr -cd 'a-z0-9' "${_target}.sha256sum" 219 | done 220 | zip -9qr "${OLDPWD}/u-${j%-}.zip" * 221 | gh_release_put "${OLDPWD}/u-${j%-}.zip" "${GITHUB_REPOSITORY##*/}-${j}${FRIDA_VERSION}-${zy_ver}.zip" 222 | rm -rf * 223 | popd 224 | done 225 | 226 | MAGISK_DIR="$(mktemp -d)"; mkdir -p "${MAGISK_DIR}/files" 227 | 228 | cat <feed.json 229 | { 230 | "version": "${FRIDA_VERSION}", 231 | "versionCode": "$(echo -n "${FRIDA_VERSION}" | xargs -d. -n1 -- printf '%02d')$(date +%s)", 232 | "zipUrl": "https://github.com/${GITHUB_REPOSITORY}/releases/download/${FRIDA_VERSION}/${GITHUB_REPOSITORY##*/}-magisk-${FRIDA_VERSION}.zip", 233 | "changelog": "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/master/CHANGELOG.md" 234 | } 235 | EOF 236 | gh_release_put feed.json feed.json 237 | 238 | cat <"${MAGISK_DIR}/module.prop" 239 | id=${GITHUB_REPOSITORY##*/} 240 | name=Undetected F(lo)rida 241 | version=${FRIDA_VERSION} 242 | versionCode=$(echo -n "${FRIDA_VERSION}" | xargs -d. -n1 -- printf '%02d')$(date +%s) 243 | author=too many to list, ask for shoutout in repo 244 | description=Run ${GITHUB_REPOSITORY##*/}-server on boot 245 | updateJson=https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/feed.json 246 | EOF 247 | 248 | cp -r magisk/* "${MAGISK_DIR}" 249 | mv frida-artifacts/frida-server-* "${MAGISK_DIR}/files/" 250 | pushd "${MAGISK_DIR}" 251 | zip -9qr "${OLDPWD}/magisk.zip" * 252 | gh_release_put "${OLDPWD}/magisk.zip" "${GITHUB_REPOSITORY##*/}-magisk-${FRIDA_VERSION}.zip" 253 | popd 254 | 255 | echo '{"draft":false}' | curl -fs -H "Authorization: token ${GITHUB_TOKEN}" -H "Content-Type: application/json" -d@- -o /dev/null -XPATCH "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ needs.create.outputs.RELEASE_ID }}" 256 | -------------------------------------------------------------------------------- /asenosen/frida-core/0001-socket-thread-secontext-renames.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/agent/agent.vala b/lib/agent/agent.vala 2 | index 44e37594..c92aa560 100644 3 | --- a/lib/agent/agent.vala 4 | +++ b/lib/agent/agent.vala 5 | @@ -335,7 +335,7 @@ namespace Frida.Agent { 6 | } 7 | 8 | private void keep_running_eternalized () { 9 | - agent_gthread = new Thread ("frida-eternal-agent", () => { 10 | + agent_gthread = new Thread ("${FRIDA_PREFIX}-eternal-agent", () => { 11 | var ignore_scope = new ThreadIgnoreScope (FRIDA_THREAD); 12 | 13 | agent_tid = Gum.Process.get_current_thread_id (); 14 | @@ -531,7 +531,7 @@ namespace Frida.Agent { 15 | assert_not_reached (); 16 | } 17 | } else { 18 | - agent_gthread = new Thread ("frida-eternal-agent", () => { 19 | + agent_gthread = new Thread ("${FRIDA_PREFIX}-eternal-agent", () => { 20 | var ignore_scope = new ThreadIgnoreScope (FRIDA_THREAD); 21 | run_after_transition (); 22 | ignore_scope = null; 23 | @@ -639,7 +639,7 @@ namespace Frida.Agent { 24 | assert_not_reached (); 25 | } 26 | } else { 27 | - agent_gthread = new Thread ("frida-eternal-agent", () => { 28 | + agent_gthread = new Thread ("${FRIDA_PREFIX}-eternal-agent", () => { 29 | var ignore_scope = new ThreadIgnoreScope (FRIDA_THREAD); 30 | run_after_transition (); 31 | ignore_scope = null; 32 | @@ -1399,7 +1399,7 @@ namespace Frida.Agent { 33 | 34 | emulated_bridge_state = new BridgeState (parameters.str); 35 | 36 | - emulated_worker = new Thread ("frida-agent-emulated", run_emulated_agent); 37 | + emulated_worker = new Thread ("${FRIDA_PREFIX}-agent-emulated", run_emulated_agent); 38 | 39 | var connection = yield new DBusConnection (stream, ServerGuid.HOST_SESSION_SERVICE, 40 | AUTHENTICATION_SERVER | AUTHENTICATION_ALLOW_ANONYMOUS, null, cancellable); 41 | diff --git a/lib/base/p2p.vala b/lib/base/p2p.vala 42 | index fcf93371..27584d10 100644 43 | --- a/lib/base/p2p.vala 44 | +++ b/lib/base/p2p.vala 45 | @@ -1100,7 +1100,7 @@ namespace Frida { 46 | string? result_cert_pem = null; 47 | string? result_key_pem = null; 48 | 49 | - new Thread ("frida-generate-certificate", () => { 50 | + new Thread ("${FRIDA_PREFIX}-generate-certificate", () => { 51 | uint8[] local_cert_der; 52 | string local_cert_pem; 53 | string local_key_pem; 54 | diff --git a/lib/base/session.vala b/lib/base/session.vala 55 | index eab36c49..bf61407f 100644 56 | --- a/lib/base/session.vala 57 | +++ b/lib/base/session.vala 58 | @@ -292,7 +292,7 @@ namespace Frida { 59 | var offer = PeerSessionDescription.parse (offer_sdp); 60 | 61 | var agent = new Nice.Agent.full (dbus_context, Nice.Compatibility.RFC5245, ICE_TRICKLE); 62 | - agent.set_software ("Frida"); 63 | + agent.set_software ("${FRIDA_PREFIX}"); 64 | agent.controlling_mode = false; 65 | agent.ice_tcp = false; 66 | 67 | @@ -2033,7 +2033,7 @@ namespace Frida { 68 | #endif 69 | 70 | namespace ServerGuid { 71 | - public const string HOST_SESSION_SERVICE = "6769746875622e636f6d2f6672696461"; 72 | + public const string HOST_SESSION_SERVICE = "${SESSION_SERVICE}"; 73 | } 74 | 75 | namespace ObjectPath { 76 | diff --git a/lib/base/socket.vala b/lib/base/socket.vala 77 | index 1ba8d338..1289f9b4 100644 78 | --- a/lib/base/socket.vala 79 | +++ b/lib/base/socket.vala 80 | @@ -163,7 +163,7 @@ namespace Frida { 81 | var msg = new Soup.Message.from_uri ("GET", uri); 82 | Soup.websocket_client_prepare_handshake (msg, origin, null, null); 83 | msg.request_headers.replace ("Host", make_host_header_value (uri)); 84 | - msg.request_headers.replace ("User-Agent", "Frida/" + _version_string ()); 85 | + msg.request_headers.replace ("User-Agent", "${FRIDA_PREFIX}/" + _version_string ()); 86 | msg.request_headers.foreach ((name, val) => { 87 | request.append (name + ": " + val + "\r\n"); 88 | }); 89 | @@ -577,7 +577,7 @@ namespace Frida { 90 | 91 | private void on_asset_request (Soup.Server server, Soup.ServerMessage msg, string path, 92 | HashTable? query) { 93 | - msg.get_response_headers ().replace ("Server", "Frida/" + _version_string ()); 94 | + msg.get_response_headers ().replace ("Server", "${FRIDA_PREFIX}/" + _version_string ()); 95 | 96 | unowned string method = msg.get_method (); 97 | if (method != "GET" && method != "HEAD") { 98 | @@ -794,7 +794,7 @@ namespace Frida { 99 |

301 Moved Permanently

100 |
%s
101 | 102 | -""".printf ("Frida/" + _version_string ()); 103 | +""".printf ("${FRIDA_PREFIX}/" + _version_string ()); 104 | 105 | if (msg.get_method () == "HEAD") { 106 | var headers = msg.get_response_headers (); 107 | diff --git a/lib/gadget/gadget-glue.c b/lib/gadget/gadget-glue.c 108 | index 256b8d99..079945e8 100644 109 | --- a/lib/gadget/gadget-glue.c 110 | +++ b/lib/gadget/gadget-glue.c 111 | @@ -106,7 +106,7 @@ frida_gadget_environment_init (void) 112 | 113 | worker_context = g_main_context_ref (g_main_context_default ()); 114 | worker_loop = g_main_loop_new (worker_context, FALSE); 115 | - worker_thread = g_thread_new ("frida-gadget", run_worker_loop, NULL); 116 | + worker_thread = g_thread_new ("${FRIDA_PREFIX}-gadget", run_worker_loop, NULL); 117 | } 118 | 119 | void 120 | diff --git a/lib/gadget/gadget.vala b/lib/gadget/gadget.vala 121 | index 1227833c..112091dd 100644 122 | --- a/lib/gadget/gadget.vala 123 | +++ b/lib/gadget/gadget.vala 124 | @@ -650,7 +650,7 @@ namespace Frida.Gadget { 125 | var inet_address = listen_address as InetSocketAddress; 126 | if (inet_address != null) { 127 | uint16 listen_port = inet_address.get_port (); 128 | - Environment.set_thread_name ("frida-gadget-tcp-%u".printf (listen_port)); 129 | + Environment.set_thread_name ("${FRIDA_PREFIX}-gadget-tcp-%u".printf (listen_port)); 130 | if (request != null) { 131 | request.set_value (listen_port); 132 | } else { 133 | @@ -661,7 +661,7 @@ namespace Frida.Gadget { 134 | } else { 135 | #if !WINDOWS 136 | var unix_address = (UnixSocketAddress) listen_address; 137 | - Environment.set_thread_name ("frida-gadget-unix"); 138 | + Environment.set_thread_name ("${FRIDA_PREFIX}-gadget-unix"); 139 | if (request != null) { 140 | request.set_value (0); 141 | } else { 142 | @@ -1778,7 +1778,7 @@ namespace Frida.Gadget { 143 | } 144 | 145 | uint pid = get_process_id (); 146 | - string identifier = "re.frida.Gadget"; 147 | + string identifier = "re.${FRIDA_PREFIX}.Gadget"; 148 | string name = "Gadget"; 149 | var no_parameters = make_parameters_dict (); 150 | this_app = HostApplicationInfo (identifier, name, pid, no_parameters); 151 | diff --git a/lib/pipe/pipe.vala b/lib/pipe/pipe.vala 152 | index 58d064d8..2c0e0783 100644 153 | --- a/lib/pipe/pipe.vala 154 | +++ b/lib/pipe/pipe.vala 155 | @@ -167,7 +167,7 @@ namespace Frida { 156 | 157 | Posix.chmod (path, Posix.S_IRUSR | Posix.S_IWUSR | Posix.S_IRGRP | Posix.S_IWGRP | Posix.S_IROTH | Posix.S_IWOTH); 158 | #if ANDROID 159 | - SELinux.setfilecon (path, "u:object_r:frida_file:s0"); 160 | + SELinux.setfilecon (path, "u:object_r:${FRIDA_PREFIX}_file:s0"); 161 | #endif 162 | 163 | establish_server.begin (socket, server_address, promise, cancellable); 164 | diff --git a/lib/selinux/patch.c b/lib/selinux/patch.c 165 | index db631ffd..d4fb16ae 100644 166 | --- a/lib/selinux/patch.c 167 | +++ b/lib/selinux/patch.c 168 | @@ -39,9 +39,9 @@ static gboolean frida_set_file_contents (const gchar * filename, const gchar * c 169 | static const FridaSELinuxRule frida_selinux_rules[] = 170 | { 171 | { { "domain", NULL }, "domain", "process", { "execmem", NULL } }, 172 | - { { "domain", NULL }, "frida_file", "dir", { "search", NULL } }, 173 | - { { "domain", NULL }, "frida_file", "file", { "open", "read", "getattr", "execute", "?map", NULL } }, 174 | - { { "domain", NULL }, "frida_memfd", "file", { "open", "read", "write", "getattr", "execute", "?map", NULL } }, 175 | + { { "domain", NULL }, "${FRIDA_PREFIX}_file", "dir", { "search", NULL } }, 176 | + { { "domain", NULL }, "${FRIDA_PREFIX}_file", "file", { "open", "read", "getattr", "execute", "?map", NULL } }, 177 | + { { "domain", NULL }, "${FRIDA_PREFIX}_memfd", "file", { "open", "read", "write", "getattr", "execute", "?map", NULL } }, 178 | { { "domain", NULL }, "shell_data_file", "dir", { "search", NULL } }, 179 | { { "domain", NULL }, "zygote_exec", "file", { "execute", NULL } }, 180 | { { "domain", NULL }, "$self", "process", { "sigchld", NULL } }, 181 | @@ -82,14 +82,14 @@ frida_selinux_patch_policy (void) 182 | res = policydb_load_isids (&db, &sidtab); 183 | g_assert (res == 0); 184 | 185 | - if (frida_ensure_type (&db, "frida_file", 2, "file_type", "mlstrustedobject", &error) == NULL) 186 | + if (frida_ensure_type (&db, "${FRIDA_PREFIX}_file", 2, "file_type", "mlstrustedobject", &error) == NULL) 187 | { 188 | g_printerr ("Unable to add SELinux type: %s\n", error->message); 189 | g_clear_error (&error); 190 | goto beach; 191 | } 192 | 193 | - if (frida_ensure_type (&db, "frida_memfd", 2, "file_type", "mlstrustedobject", &error) == NULL) 194 | + if (frida_ensure_type (&db, "${FRIDA_PREFIX}_memfd", 2, "file_type", "mlstrustedobject", &error) == NULL) 195 | { 196 | g_printerr ("Unable to add SELinux type: %s\n", error->message); 197 | g_clear_error (&error); 198 | diff --git a/meson.build b/meson.build 199 | index b96edc83..2716dc31 100644 200 | --- a/meson.build 201 | +++ b/meson.build 202 | @@ -385,7 +385,7 @@ configure_file( 203 | 204 | add_project_arguments( 205 | (cc.get_argument_syntax() == 'msvc') ? '/FI' : '-include', meson.current_build_dir() / 'config.h', 206 | - '-DG_LOG_DOMAIN="Frida"', 207 | + '-DG_LOG_DOMAIN="${FRIDA_PREFIX}"', 208 | '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56', 209 | '-DG_DISABLE_DEPRECATED', 210 | language: c_languages) 211 | diff --git a/server/server.vala b/server/server.vala 212 | index 67bf4b38..ccd01037 100644 213 | --- a/server/server.vala 214 | +++ b/server/server.vala 215 | @@ -179,7 +179,7 @@ namespace Frida.Server { 216 | Environment.configure (); 217 | 218 | #if DARWIN 219 | - var worker = new Thread ("frida-server-main-loop", () => { 220 | + var worker = new Thread ("${FRIDA_PREFIX}-server-main-loop", () => { 221 | var exit_code = run_application (device_id, endpoint_params, options, on_ready); 222 | 223 | _stop_run_loop (); 224 | diff --git a/src/agent-container.vala b/src/agent-container.vala 225 | index a8db6b29..8ea740fa 100644 226 | --- a/src/agent-container.vala 227 | +++ b/src/agent-container.vala 228 | @@ -25,7 +25,7 @@ namespace Frida { 229 | assert (container.module != null); 230 | 231 | void * main_func_symbol; 232 | - var main_func_found = container.module.symbol ("frida_agent_main", out main_func_symbol); 233 | + var main_func_found = container.module.symbol ("${FRIDA_PREFIX}_agent_main", out main_func_symbol); 234 | assert (main_func_found); 235 | container.main_impl = (AgentMainFunc) main_func_symbol; 236 | 237 | @@ -100,7 +100,7 @@ namespace Frida { 238 | } 239 | 240 | private void start_worker_thread () { 241 | - thread = new Thread ("frida-agent-container", run); 242 | + thread = new Thread ("${FRIDA_PREFIX}-agent-container", run); 243 | } 244 | 245 | private void stop_worker_thread () { 246 | diff --git a/src/droidy/injector.vala b/src/droidy/injector.vala 247 | index f2acafb0..1463a529 100644 248 | --- a/src/droidy/injector.vala 249 | +++ b/src/droidy/injector.vala 250 | @@ -81,7 +81,7 @@ namespace Frida.Droidy.Injector { 251 | string so_path_app = "/data/data/" + package + "/gadget.so"; 252 | string config_path_shared = "/data/local/tmp/frida-gadget-" + instance_id + ".config"; 253 | string config_path_app = "/data/data/" + package + "/gadget.config"; 254 | - string unix_socket_path = "frida:" + package; 255 | + string unix_socket_path = "${FRIDA_PREFIX}:" + package; 256 | 257 | bool waiting = false; 258 | uint target_pid = 0; 259 | diff --git a/src/frida-glue.c b/src/frida-glue.c 260 | index ee8f0737..76ed813e 100644 261 | --- a/src/frida-glue.c 262 | +++ b/src/frida-glue.c 263 | @@ -44,7 +44,7 @@ frida_init_with_runtime (FridaRuntime rt) 264 | { 265 | main_context = g_main_context_ref (g_main_context_default ()); 266 | main_loop = g_main_loop_new (main_context, FALSE); 267 | - main_thread = g_thread_new ("frida-main-loop", run_main_loop, NULL); 268 | + main_thread = g_thread_new ("${FRIDA_PREFIX}-main-loop", run_main_loop, NULL); 269 | } 270 | 271 | g_once_init_leave (&frida_initialized, TRUE); 272 | diff --git a/src/frida.vala b/src/frida.vala 273 | index 2f07a886..fee02670 100644 274 | --- a/src/frida.vala 275 | +++ b/src/frida.vala 276 | @@ -2312,7 +2312,7 @@ namespace Frida { 277 | dbus_context = yield get_dbus_context (); 278 | 279 | var agent = new Nice.Agent.full (dbus_context, Nice.Compatibility.RFC5245, ICE_TRICKLE); 280 | - agent.set_software ("Frida"); 281 | + agent.set_software ("${FRIDA_PREFIX}"); 282 | agent.controlling_mode = true; 283 | agent.ice_tcp = false; 284 | 285 | diff --git a/src/linux/frida-helper-backend.vala b/src/linux/frida-helper-backend.vala 286 | index a4be8c42..114ee634 100644 287 | --- a/src/linux/frida-helper-backend.vala 288 | +++ b/src/linux/frida-helper-backend.vala 289 | @@ -1213,7 +1213,7 @@ namespace Frida { 290 | } 291 | 292 | private static string make_fallback_address () { 293 | - return "/frida-" + Uuid.string_random (); 294 | + return "/${FRIDA_PREFIX}-" + Uuid.string_random (); 295 | } 296 | 297 | private Future establish_connection (LoaderLaunch launch, InjectSpec spec, BootstrapResult bres, 298 | diff --git a/src/linux/frida-helper-process.vala b/src/linux/frida-helper-process.vala 299 | index 7e5cf0cc..8e57b46c 100644 300 | --- a/src/linux/frida-helper-process.vala 301 | +++ b/src/linux/frida-helper-process.vala 302 | @@ -315,7 +315,7 @@ namespace Frida { 303 | TimeoutSource? timeout_source = null; 304 | 305 | try { 306 | - string socket_path = "/frida-" + Uuid.string_random (); 307 | + string socket_path = "/${FRIDA_PREFIX}-" + Uuid.string_random (); 308 | string socket_address = "unix:abstract=" + socket_path; 309 | 310 | service = new SocketService (); 311 | @@ -622,11 +622,11 @@ namespace Frida { 312 | #if HAVE_EMBEDDED_ASSETS 313 | var blob32 = Frida.Data.Helper.get_frida_helper_32_blob (); 314 | if (blob32.data.length > 0) 315 | - helper32 = make_temporary_helper ("frida-helper-32", blob32.data); 316 | + helper32 = make_temporary_helper ("${FRIDA_PREFIX}-helper-32", blob32.data); 317 | 318 | var blob64 = Frida.Data.Helper.get_frida_helper_64_blob (); 319 | if (blob64.data.length > 0) 320 | - helper64 = make_temporary_helper ("frida-helper-64", blob64.data); 321 | + helper64 = make_temporary_helper ("${FRIDA_PREFIX}-helper-64", blob64.data); 322 | #else 323 | var tpl = PathTemplate (Config.FRIDA_HELPER_PATH); 324 | string path = tpl.expand ((sizeof (void *) == 8) ? "32" : "64"); 325 | diff --git a/src/linux/linjector.vala b/src/linux/linjector.vala 326 | index 0dfa33d8..d65d498f 100644 327 | --- a/src/linux/linjector.vala 328 | +++ b/src/linux/linjector.vala 329 | @@ -266,14 +267,14 @@ namespace Frida { 330 | private static void adjust_directory_permissions (string path) { 331 | FileUtils.chmod (path, 0755); 332 | #if ANDROID 333 | - SELinux.setfilecon (path, "u:object_r:frida_file:s0"); 334 | + SELinux.setfilecon (path, "u:object_r:${FRIDA_PREFIX}_file:s0"); 335 | #endif 336 | } 337 | 338 | private static void adjust_file_permissions (string path) { 339 | FileUtils.chmod (path, path.has_suffix (".so") ? 0755 : 0644); 340 | #if ANDROID 341 | - SELinux.setfilecon (path, "u:object_r:frida_file:s0"); 342 | + SELinux.setfilecon (path, "u:object_r:${FRIDA_PREFIX}_file:s0"); 343 | #endif 344 | } 345 | } 346 | -------------------------------------------------------------------------------- /aimardcr/gumjs-quote-detection-bypass-unquote.patch: -------------------------------------------------------------------------------- 1 | ## i could try to slim down the differences, but this is… effort not warranting further effort 2 | # source (a): frida-16.6.6 gumjs devkit 3 | # target (b): androgum "detection bypass" gumjs devkit, based on frida 16.2.1 4 | diff --git a/frida-gumjs.h b/frida-gumjs.h 5 | index b80ac36..bdd603a 100644 6 | --- a/frida-gumjs.h 2025-02-15 10:27:51.185767111 +0100 7 | +++ b/frida-gumjs.h 2025-02-15 10:27:53.159115580 +0100 8 | @@ -2680,11 +2680,6 @@ 9 | #define g_ptr_array_steal_index _frida_g_ptr_array_steal_index 10 | #define g_ptr_array_steal_index_fast _frida_g_ptr_array_steal_index_fast 11 | #define g_ptr_array_unref _frida_g_ptr_array_unref 12 | -#define g_ptr_set_add _frida_g_ptr_set_add 13 | -#define g_ptr_set_foreach _frida_g_ptr_set_foreach 14 | -#define g_ptr_set_free _frida_g_ptr_set_free 15 | -#define g_ptr_set_new _frida_g_ptr_set_new 16 | -#define g_ptr_set_remove _frida_g_ptr_set_remove 17 | #define g_qsort_with_data _frida_g_qsort_with_data 18 | #define g_quark_from_static_string _frida_g_quark_from_static_string 19 | #define g_quark_from_string _frida_g_quark_from_string 20 | @@ -3796,6 +3791,10 @@ 21 | #define g_timer_reset _frida_g_timer_reset 22 | #define g_timer_start _frida_g_timer_start 23 | #define g_timer_stop _frida_g_timer_stop 24 | +#define g_tinylist_foreach _frida_g_tinylist_foreach 25 | +#define g_tinylist_free _frida_g_tinylist_free 26 | +#define g_tinylist_prepend _frida_g_tinylist_prepend 27 | +#define g_tinylist_remove _frida_g_tinylist_remove 28 | #define g_tls_authentication_mode_get_type _frida_g_tls_authentication_mode_get_type 29 | #define g_tls_backend_get_certificate_type _frida_g_tls_backend_get_certificate_type 30 | #define g_tls_backend_get_client_connection_type _frida_g_tls_backend_get_client_connection_type 31 | @@ -61751,13 +61750,6 @@ GType gum_attach_return_get_type (void) 32 | GType gum_replace_return_get_type (void) G_GNUC_CONST; 33 | #define GUM_TYPE_REPLACE_RETURN (gum_replace_return_get_type ()) 34 | 35 | -/* Enumerations from "gummodule.h" */ 36 | -GType gum_import_type_get_type (void) G_GNUC_CONST; 37 | -#define GUM_TYPE_IMPORT_TYPE (gum_import_type_get_type ()) 38 | -GType gum_export_type_get_type (void) G_GNUC_CONST; 39 | -#define GUM_TYPE_EXPORT_TYPE (gum_export_type_get_type ()) 40 | -GType gum_symbol_type_get_type (void) G_GNUC_CONST; 41 | -#define GUM_TYPE_SYMBOL_TYPE (gum_symbol_type_get_type ()) 42 | GType gum_dependency_type_get_type (void) G_GNUC_CONST; 43 | #define GUM_TYPE_DEPENDENCY_TYPE (gum_dependency_type_get_type ()) 44 | 45 | @@ -62302,6 +62294,56 @@ enum _GumRelocationScenario 46 | (((gint64) (i)) >= (gint64) G_MININT32 && \ 47 | ((gint64) (i)) <= (gint64) G_MAXINT32) 48 | 49 | +# define GUM_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, \ 50 | + OBJ_NAME, ParentName) \ 51 | + G_DECLARE_FINAL_TYPE (ModuleObjName, module_obj_name, MODULE, OBJ_NAME, \ 52 | + ParentName) 53 | +# define GUM_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, \ 54 | + OBJ_NAME, PrerequisiteName) \ 55 | + G_DECLARE_INTERFACE (ModuleObjName, module_obj_name, MODULE, OBJ_NAME, \ 56 | + PrerequisiteName) 57 | +# define GUM_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) \ 58 | + G_DEFINE_BOXED_TYPE (TypeName, type_name, copy_func, free_func) 59 | +# define gum_object_ref(object) g_object_ref (object) 60 | +# define gum_object_unref(object) g_object_unref (object) 61 | +# define gum_clear_object(object_ptr) \ 62 | + g_clear_pointer ((object_ptr), g_object_unref) 63 | + 64 | +#else 65 | + 66 | +# define GUM_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, \ 67 | + OBJ_NAME, ParentName) \ 68 | + typedef struct _##ModuleObjName ModuleObjName; \ 69 | + \ 70 | + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME ( \ 71 | + gpointer obj) \ 72 | + { \ 73 | + return obj; \ 74 | + } 75 | +# define GUM_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, \ 76 | + OBJ_NAME, PrerequisiteName) \ 77 | + typedef struct _##ModuleObjName ModuleObjName; \ 78 | + \ 79 | + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME ( \ 80 | + gpointer obj) \ 81 | + { \ 82 | + return obj; \ 83 | + } 84 | +# define GUM_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) 85 | +# define gum_clear_object(object_ptr) \ 86 | + g_clear_pointer ((object_ptr), gum_object_unref) 87 | + 88 | +typedef struct _GumObject GumObject; 89 | + 90 | +struct _GumObject 91 | +{ 92 | + gint ref_count; 93 | + void (* finalize) (GumObject * object); 94 | +}; 95 | + 96 | +GUM_API gpointer gum_object_ref (gpointer object); 97 | +GUM_API void gum_object_unref (gpointer object); 98 | + 99 | #ifdef G_NORETURN 100 | # define GUM_NORETURN G_NORETURN 101 | #else 102 | @@ -62556,8 +62598,6 @@ struct _GumFileMapping 103 | gsize size; 104 | }; 105 | 106 | -typedef gboolean (* GumFoundRangeFunc) (const GumRangeDetails * details, 107 | - gpointer user_data); 108 | typedef void (* GumMemoryPatchApplyFunc) (gpointer mem, gpointer user_data); 109 | typedef gboolean (* GumMemoryScanMatchFunc) (GumAddress address, gsize size, 110 | gpointer user_data); 111 | @@ -62671,15 +62711,11 @@ G_END_DECLS 112 | * Licence: wxWindows Library Licence, Version 3.1 113 | */ 114 | 115 | -#ifndef __GUM_MODULE_H__ 116 | -#define __GUM_MODULE_H__ 117 | - 118 | - 119 | G_BEGIN_DECLS 120 | 121 | -#define GUM_TYPE_MODULE (gum_module_get_type ()) 122 | -G_DECLARE_INTERFACE (GumModule, gum_module, GUM, MODULE, GObject) 123 | - 124 | +typedef guint GumImportType; 125 | +typedef guint GumExportType; 126 | +typedef guint GumSymbolType; 127 | typedef struct _GumImportDetails GumImportDetails; 128 | typedef struct _GumExportDetails GumExportDetails; 129 | typedef struct _GumSymbolDetails GumSymbolDetails; 130 | @@ -62695,23 +62731,22 @@ typedef gboolean (* GumFoundSymbolFunc) 131 | gpointer user_data); 132 | typedef gboolean (* GumFoundSectionFunc) (const GumSectionDetails * details, 133 | gpointer user_data); 134 | -typedef gboolean (* GumFoundDependencyFunc) ( 135 | - const GumDependencyDetails * details, gpointer user_data); 136 | -typedef GumAddress (* GumResolveExportFunc) (const char * module_name, 137 | - const char * symbol_name, gpointer user_data); 138 | 139 | -typedef enum { 140 | +enum _GumImportType 141 | +{ 142 | GUM_IMPORT_UNKNOWN, 143 | GUM_IMPORT_FUNCTION, 144 | GUM_IMPORT_VARIABLE 145 | -} GumImportType; 146 | +}; 147 | 148 | -typedef enum { 149 | +enum _GumExportType 150 | +{ 151 | GUM_EXPORT_FUNCTION = 1, 152 | GUM_EXPORT_VARIABLE 153 | -} GumExportType; 154 | +}; 155 | 156 | -typedef enum { 157 | +enum _GumSymbolType 158 | +{ 159 | /* Common */ 160 | GUM_SYMBOL_UNKNOWN, 161 | GUM_SYMBOL_SECTION, 162 | @@ -62728,32 +62763,6 @@ typedef enum { 163 | GUM_SYMBOL_FILE, 164 | GUM_SYMBOL_COMMON, 165 | GUM_SYMBOL_TLS, 166 | -} GumSymbolType; 167 | - 168 | -struct _GumModuleInterface 169 | -{ 170 | - GTypeInterface parent; 171 | - 172 | - const gchar * (* get_name) (GumModule * self); 173 | - const gchar * (* get_path) (GumModule * self); 174 | - const GumMemoryRange * (* get_range) (GumModule * self); 175 | - void (* ensure_initialized) (GumModule * self); 176 | - void (* enumerate_imports) (GumModule * self, GumFoundImportFunc func, 177 | - gpointer user_data); 178 | - void (* enumerate_exports) (GumModule * self, GumFoundExportFunc func, 179 | - gpointer user_data); 180 | - void (* enumerate_symbols) (GumModule * self, GumFoundSymbolFunc func, 181 | - gpointer user_data); 182 | - void (* enumerate_ranges) (GumModule * self, GumPageProtection prot, 183 | - GumFoundRangeFunc func, gpointer user_data); 184 | - void (* enumerate_sections) (GumModule * self, GumFoundSectionFunc func, 185 | - gpointer user_data); 186 | - void (* enumerate_dependencies) (GumModule * self, 187 | - GumFoundDependencyFunc func, gpointer user_data); 188 | - GumAddress (* find_export_by_name) (GumModule * self, 189 | - const gchar * symbol_name); 190 | - GumAddress (* find_symbol_by_name) (GumModule * self, 191 | - const gchar * symbol_name); 192 | }; 193 | 194 | struct _GumImportDetails 195 | @@ -62809,31 +62818,27 @@ struct _GumDependencyDetails 196 | GumDependencyType type; 197 | }; 198 | 199 | -GUM_API GumModule * gum_module_load (const gchar * module_name, 200 | +GUM_API gboolean gum_module_load (const gchar * module_name, 201 | GError ** error); 202 | 203 | -GUM_API const gchar * gum_module_get_name (GumModule * self); 204 | -GUM_API const gchar * gum_module_get_path (GumModule * self); 205 | -GUM_API const GumMemoryRange * gum_module_get_range (GumModule * self); 206 | 207 | -GUM_API void gum_module_ensure_initialized (GumModule * self); 208 | -GUM_API void gum_module_enumerate_imports (GumModule * self, 209 | +GUM_API gboolean gum_module_ensure_initialized (const gchar * module_name); 210 | +GUM_API void gum_module_enumerate_imports (const gchar * module_name, 211 | GumFoundImportFunc func, gpointer user_data); 212 | -GUM_API void gum_module_enumerate_exports (GumModule * self, 213 | +GUM_API void gum_module_enumerate_exports (const gchar * module_name, 214 | GumFoundExportFunc func, gpointer user_data); 215 | -GUM_API void gum_module_enumerate_symbols (GumModule * self, 216 | +GUM_API void gum_module_enumerate_symbols (const gchar * module_name, 217 | GumFoundSymbolFunc func, gpointer user_data); 218 | -GUM_API void gum_module_enumerate_ranges (GumModule * self, 219 | +GUM_API void gum_module_enumerate_ranges (const gchar * module_name, 220 | GumPageProtection prot, GumFoundRangeFunc func, gpointer user_data); 221 | -GUM_API void gum_module_enumerate_sections (GumModule * self, 222 | +GUM_API void gum_module_enumerate_sections (const gchar * module_name, 223 | GumFoundSectionFunc func, gpointer user_data); 224 | -GUM_API void gum_module_enumerate_dependencies (GumModule * self, 225 | +GUM_API void gum_module_enumerate_dependencies (const gchar * module_name, 226 | GumFoundDependencyFunc func, gpointer user_data); 227 | -GUM_API GumAddress gum_module_find_export_by_name (GumModule * self, 228 | - const gchar * symbol_name); 229 | -GUM_API GumAddress gum_module_find_global_export_by_name ( 230 | +GUM_API GumAddress gum_module_find_base_address (const gchar * module_name); 231 | +GUM_API GumAddress gum_module_find_export_by_name (const gchar * module_name, 232 | const gchar * symbol_name); 233 | -GUM_API GumAddress gum_module_find_symbol_by_name (GumModule * self, 234 | +GUM_API GumAddress gum_module_find_symbol_by_name (const gchar * module_name, 235 | const gchar * symbol_name); 236 | 237 | G_END_DECLS 238 | @@ -62896,10 +62901,14 @@ typedef void (* GumModifyThreadFunc) (Gu 239 | GumCpuContext * cpu_context, gpointer user_data); 240 | typedef gboolean (* GumFoundThreadFunc) (const GumThreadDetails * details, 241 | gpointer user_data); 242 | -typedef gboolean (* GumFoundModuleFunc) (GumModule * module, 243 | +typedef gboolean (* GumFoundModuleFunc) (const GumModuleDetails * details, 244 | gpointer user_data); 245 | +typedef gboolean (* GumFoundDependencyFunc) ( 246 | + const GumDependencyDetails * details, gpointer user_data); 247 | typedef gboolean (* GumFoundMallocRangeFunc) ( 248 | const GumMallocRangeDetails * details, gpointer user_data); 249 | +typedef GumAddress (* GumResolveExportFunc) (const char * module_name, 250 | + const char * symbol_name, gpointer user_data); 251 | 252 | GUM_API GumOS gum_process_get_native_os (void); 253 | GUM_API GumTeardownRequirement gum_process_get_teardown_requirement (void); 254 | @@ -62915,10 +62924,10 @@ GUM_API gboolean gum_process_modify_thre 255 | GumModifyThreadFunc func, gpointer user_data, GumModifyThreadFlags flags); 256 | GUM_API void gum_process_enumerate_threads (GumFoundThreadFunc func, 257 | gpointer user_data); 258 | -GUM_API GumModule * gum_process_get_main_module (void); 259 | -GUM_API GumModule * gum_process_get_libc_module (void); 260 | -GUM_API GumModule * gum_process_find_module_by_name (const gchar * name); 261 | -GUM_API GumModule * gum_process_find_module_by_address (GumAddress address); 262 | +GUM_API const GumModuleDetails * gum_process_get_main_module (void); 263 | +GUM_API const gchar * gum_process_query_libc_name (void); 264 | +GUM_API gboolean gum_process_resolve_module_pointer (gconstpointer ptr, 265 | + gchar ** path, GumMemoryRange * range); 266 | GUM_API void gum_process_enumerate_modules (GumFoundModuleFunc func, 267 | gpointer user_data); 268 | GUM_API void gum_process_enumerate_ranges (GumPageProtection prot, 269 | @@ -62944,6 +62953,11 @@ GUM_API gboolean gum_thread_unset_hardwa 270 | GUM_API const gchar * gum_code_signing_policy_to_string ( 271 | GumCodeSigningPolicy policy); 272 | 273 | +GUM_API GType gum_module_details_get_type (void) G_GNUC_CONST; 274 | +GUM_API GumModuleDetails * gum_module_details_copy ( 275 | + const GumModuleDetails * module); 276 | +GUM_API void gum_module_details_free (GumModuleDetails * module); 277 | + 278 | GUM_API const gchar * gum_symbol_type_to_string (GumSymbolType type); 279 | 280 | G_END_DECLS 281 | @@ -63270,7 +63284,6 @@ struct _GumDarwinModule 282 | 283 | GArray * segments; 284 | GArray * text_ranges; 285 | - gsize text_size; 286 | 287 | const guint8 * rebases; 288 | const guint8 * rebases_end; 289 | @@ -65322,7 +65335,7 @@ G_END_DECLS 290 | G_BEGIN_DECLS 291 | 292 | typedef struct _GumKernelModuleRangeDetails GumKernelModuleRangeDetails; 293 | -typedef struct _GumKernelModuleDetails GumKernelModuleDetails; 294 | +typedef struct _GumModuleDetails GumModuleDetails; 295 | 296 | struct _GumKernelModuleRangeDetails 297 | { 298 | @@ -65332,7 +65345,7 @@ struct _GumKernelModuleRangeDetails 299 | GumPageProtection protection; 300 | }; 301 | 302 | -struct _GumKernelModuleDetails 303 | +struct _GumModuleDetails 304 | { 305 | const gchar * name; 306 | const GumMemoryRange * range; 307 | @@ -65341,8 +65354,6 @@ struct _GumKernelModuleDetails 308 | 309 | typedef gboolean (* GumFoundKernelModuleRangeFunc) ( 310 | const GumKernelModuleRangeDetails * details, gpointer user_data); 311 | -typedef gboolean (* GumFoundKernelModuleFunc) ( 312 | - const GumKernelModuleDetails * details, gpointer user_data); 313 | 314 | GUM_API gboolean gum_kernel_api_is_available (void); 315 | GUM_API guint gum_kernel_query_page_size (void); 316 | @@ -65362,7 +65373,7 @@ GUM_API void gum_kernel_enumerate_ranges 317 | GUM_API void gum_kernel_enumerate_module_ranges (const gchar * module_name, 318 | GumPageProtection prot, GumFoundKernelModuleRangeFunc func, 319 | gpointer user_data); 320 | -GUM_API void gum_kernel_enumerate_modules (GumFoundKernelModuleFunc func, 321 | +GUM_API void gum_kernel_enumerate_modules (GumFoundModuleFunc func, 322 | gpointer user_data); 323 | GUM_API GumAddress gum_kernel_find_base_address (void); 324 | GUM_API void gum_kernel_set_base_address (GumAddress base); 325 | @@ -65633,19 +65644,19 @@ G_BEGIN_DECLS 326 | #define GUM_TYPE_MODULE_MAP (gum_module_map_get_type ()) 327 | G_DECLARE_FINAL_TYPE (GumModuleMap, gum_module_map, GUM, MODULE_MAP, GObject) 328 | 329 | -typedef gboolean (* GumModuleMapFilterFunc) (GumModule * module, 330 | +typedef gboolean (* GumModuleMapFilterFunc) (const GumModuleDetails * details, 331 | gpointer user_data); 332 | 333 | GUM_API GumModuleMap * gum_module_map_new (void); 334 | GUM_API GumModuleMap * gum_module_map_new_filtered (GumModuleMapFilterFunc func, 335 | gpointer data, GDestroyNotify data_destroy); 336 | 337 | -GUM_API GumModule * gum_module_map_find (GumModuleMap * self, 338 | +GUM_API const GumModuleDetails * gum_module_map_find (GumModuleMap * self, 339 | GumAddress address); 340 | 341 | GUM_API void gum_module_map_update (GumModuleMap * self); 342 | 343 | -GUM_API GPtrArray * gum_module_map_get_values (GumModuleMap * self); 344 | +GUM_API GArray * gum_module_map_get_values (GumModuleMap * self); 345 | 346 | G_END_DECLS 347 | 348 | diff --git a/releng/devkit-assets/frida-gumjs-example-unix.c b/releng/devkit-assets/frida-gumjs-example-unix.c 349 | index b80ac36..af74b5a 100644 350 | --- a/releng/devkit-assets/frida-gumjs-example-unix.c 351 | +++ b/releng/devkit-assets/frida-gumjs-example-unix.c 352 | @@ -21,15 +21,8 @@ main (int argc, 353 | backend = gum_script_backend_obtain_qjs (); 354 | 355 | script = gum_script_backend_create_sync (backend, "example", 356 | - "Interceptor.attach(Module.getExportByName(null, 'open'), {\n" 357 | - " onEnter(args) {\n" 358 | - " console.log(`[*] open(\"${args[0].readUtf8String()}\")`);\n" 359 | - " }\n" 360 | - "});\n" 361 | - "Interceptor.attach(Module.getExportByName(null, 'close'), {\n" 362 | - " onEnter(args) {\n" 363 | - " console.log(`[*] close(${args[0].toInt32()})`);\n" 364 | - " }\n" 365 | + "Interceptor.attach(Module.getExportByName(null, 'ptrace'), {\n" 366 | + " console.log(`ptrace called\");\n" 367 | "});", 368 | NULL, cancellable, &error); 369 | g_assert (error == NULL); 370 | @@ -38,8 +31,8 @@ main (int argc, 371 | 372 | gum_script_load_sync (script, cancellable); 373 | 374 | - close (open ("/etc/hosts", O_RDONLY)); 375 | - close (open ("/etc/fstab", O_RDONLY)); 376 | + //close (open ("/etc/hosts", O_RDONLY)); 377 | + //close (open ("/etc/fstab", O_RDONLY)); 378 | 379 | context = g_main_context_get_thread_default (); 380 | while (g_main_context_pending (context)) 381 | @@ -49,7 +42,7 @@ main (int argc, 382 | 383 | g_object_unref (script); 384 | 385 | - gum_deinit_embedded (); 386 | + //gum_deinit_embedded (); 387 | 388 | return 0; 389 | } 390 | @@ -59,6 +52,7 @@ on_message (const gchar * message, 391 | GBytes * data, 392 | gpointer user_data) 393 | { 394 | + return; 395 | JsonParser * parser; 396 | JsonObject * root; 397 | const gchar * type; 398 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 489 | USA 490 | 491 | Also add information on how to contact you by electronic and paper mail. 492 | 493 | You should also get your employer (if you work as a programmer) or your 494 | school, if any, to sign a "copyright disclaimer" for the library, if 495 | necessary. Here is a sample; alter the names: 496 | 497 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 498 | library `Frob' (a library for tweaking knobs) written by James Random 499 | Hacker. 500 | 501 | , 1 April 1990 502 | Ty Coon, President of Vice 503 | 504 | That's all there is to it! 505 | --------------------------------------------------------------------------------