• This repository has been archived on 08/Jan/2024
  • Stars
    star
    4,875
  • Rank 8,615 (Top 0.2 %)
  • Language
    C++
  • Created over 6 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Inject into zygote process

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?mode=medium&illust_id=74128856)

Requirements

Android 6.0+ devices rooted with Magisk

Guide

Install

  • From Magisk Manager

    1. Search "Riru" in Magisk Manager
    2. Install the module named "Riru"

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

  • Manually

    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?

    Before v22.0, we use the method of replacing a system library (libmemtrack) that will be loaded by zygote. However, it seems to cause some weird problems. Maybe because libmemtrack is used by something else.

    Then 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.

How does Hide works?

From v22.0, Riru provides a hidden mechanism (idea from Haruue Icymoon), make the memory of Riru and module to anonymous memory to hide from "/proc/maps string scanning".

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

More Repositories

1

Shizuku

Using system APIs directly with adb/root privileges from normal apps through a Java process started with app_process.
Kotlin
9,849
star
2

Sui

Modern super user interface implementation on Android.
Java
1,829
star
3

StorageRedirect-assets

Assets (rules, apks etc) for Storage Redirect app.
Python
667
star
4

WADB

A simple switch for adb (Android Debug Bridge) over network.
Kotlin
548
star
5

Riru-LocationReportEnabler

A Riru module. Enable location report by hook system_property_get.
C++
449
star
6

Shizuku-API

The API and the developer guide for Shizuku and Sui.
Java
403
star
7

App-Ops-issue-tracker

Issue tracker for https://play.google.com/store/apps/details?id=rikka.appops
303
star
8

RikkaX

Rikka's Android libraries.
Java
268
star
9

HiddenApiRefinePlugin

A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.
Java
262
star
10

FCM-for-Mojo

Firebase Cloud Messaging for Mojo-Webqq.
Java
209
star
11

Riru-ModuleTemplate

Module template of Riru.
Shell
146
star
12

SaveCopy

Simple Android app, handle ACTION_VIEW, ACTION_SEND, ACTION_SEND_MULTIPLE, save a copy of the file. For bad apps which only allow users to open files.
Java
132
star
13

FontProvider

Provide NotoCJK (and other) fonts to other app.
Java
105
star
14

websites

Websites for Rikka apps.
Vue
71
star
15

MaterialThemeBuilder

A gradle plugin that generates Material Design 3 theme for Android projects.
Java
54
star
16

FCM-for-Mojo-Server

Server for FCM-for-Mojo
JavaScript
33
star
17

magisk-custom-sepolicy-installer

(Replaced by official solution from Magisk) Installer template for custom Magisk with "sepolicy_custom" support.
Shell
29
star
18

RikkaApps.github.io.backup

CSS
28
star
19

AutoResConfig

A gradle plugin generates resConfig & languages array from project res folder.
Java
27
star
20

Riru-AppConfig

A Riru module. Per-app system property, config (locale, etc.) modification.
10
star
21

TakoStats

Issue tracker & localization for TakoStats.
9
star
22

RikkaApps.github.io

8
star
23

AppOps-Localization

Localization files for AppOps.
4
star