Skip to content

Commit

Permalink
removed system_server and jni calls from frida-server for barebones A…
Browse files Browse the repository at this point in the history
…ndroid systems
  • Loading branch information
j005u committed Mar 4, 2022
1 parent fa81117 commit 2711520
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 1,333 deletions.
14 changes: 0 additions & 14 deletions lib/agent/agent-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,3 @@ _frida_agent_environment_deinit (void)
gum_internal_heap_unref ();
#endif
}

#ifdef HAVE_ANDROID

jint
JNI_OnLoad (JavaVM * vm, void * reserved)
{
FridaAgentBridgeState * state = reserved;

frida_agent_main (state->agent_parameters, &state->unload_policy, state->injector_state);

return JNI_VERSION_1_6;
}

#endif
19 changes: 0 additions & 19 deletions lib/gadget/gadget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -405,25 +405,6 @@ namespace Frida.Gadget {
);
}

#if ANDROID
construct {
if (executable_name.has_prefix ("app_process")) {
try {
string cmdline;
FileUtils.get_contents ("/proc/self/cmdline", out cmdline);
if (cmdline != "zygote" && cmdline != "zygote64") {
executable_name = cmdline;

cached_bundle_id = cmdline.split (":", 2)[0];
cached_bundle_name = cached_bundle_id;
did_fetch_bundle_id = true;
did_fetch_bundle_name = true;
}
} catch (FileError e) {
}
}
}
#endif

public string resolve_asset_path (string asset_path) {
if (!Path.is_absolute (asset_path)) {
Expand Down
20 changes: 0 additions & 20 deletions lib/payload/fork-monitor.vala
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,6 @@ namespace Frida {

unowned Gum.InvocationListener listener = this;

#if ANDROID
if (get_executable_path ().has_prefix ("/system/bin/app_process")) {
try {
string cmdline;
FileUtils.get_contents ("/proc/self/cmdline", out cmdline);
if (cmdline == "zygote" || cmdline == "zygote64" || cmdline == "usap32" || cmdline == "usap64") {
var set_argv0 = Gum.Module.find_export_by_name ("libandroid_runtime.so", "_Z27android_os_Process_setArgV0P7_JNIEnvP8_jobjectP8_jstring");
if (set_argv0 != null) {
interceptor.attach (set_argv0, listener, (void *) HookId.SET_ARGV0);
child_recovery_behavior = DEFERRED_UNTIL_SET_ARGV0;
}

var setcontext = Gum.Module.find_export_by_name ("libselinux.so", "selinux_android_setcontext");
if (setcontext != null)
interceptor.attach (setcontext, listener, (void *) HookId.SET_CTX);
}
} catch (FileError e) {
}
}
#endif

interceptor.attach (fork_impl, listener, (void *) HookId.FORK);
interceptor.replace (vfork_impl, fork_impl);
Expand Down
Loading

0 comments on commit 2711520

Please sign in to comment.