Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
/ Riru Public archive
forked from RikkaApps/Riru

(Riru without riruhider) Inject into zygote process

Notifications You must be signed in to change notification settings

Citrinae-Lime/Riru

 
 

Repository files navigation

Deprecated?

All Riru users and Riru modules should migrate to Zygisk.

Riru

Riru only does one thing, inject into zygote in order to allow modules to run their codes in apps or the system server.

The name, Riru, comes from a character. (https://www.pixiv.net/member_illust.php?illust_id=74128856)

Requirements

Android 6.0+ devices rooted with Magisk

Guide

Install

The Magisk version requirement is enforced by Magisk Manager. You can check Magisk's module installer script.

  1. Download the zip from the GitHub release
  2. Install in Magisk Manager (Modules - Install from storage - Select downloaded zip)

Common problems

How Riru works?

  • How to inject into the zygote process?

    We found a super easy way, the "native bridge" (ro.dalvik.vm.native.bridge). The specific "so" file will be automatically "dlopen-ed" and "dlclose-ed" by the system. This way is from here.

  • How to know if we are in an app process or a system server process?

    Some JNI functions (com.android.internal.os.Zygote#nativeForkAndSpecialize & com.android.internal.os.Zygote#nativeForkSystemServer) is to fork the app process or the system server process. So we need to replace these functions with ours. This part is simple, hook jniRegisterNativeMethods since all Java native methods in libandroid_runtime.so is registered through this function. Then we can call the original jniRegisterNativeMethods again to replace them.

Build

Gradle tasks:

  • :riru:assembleDebug/Release

    Generate Magisk module zip to out.

  • :riru:pushDebug/Release

    Push the zip with adb to /data/local/tmp.

  • :riru:flashDebug/Release

    Flash the zip with adb shell su -c magisk --install-module.

  • :riru:flashAndRebootDebug/Release

    Flash the zip and reboot the device.

Module template

https://github.com/RikkaApps/Riru-ModuleTemplate

Module API changes

https://github.com/RikkaApps/Riru-ModuleTemplate/blob/master/README.md#api-changes

About

(Riru without riruhider) Inject into zygote process

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 62.2%
  • Java 24.3%
  • Shell 7.3%
  • C 4.2%
  • CMake 2.0%