ZRoot is a library that makes it easy to use root on Android, such as calling system service with root privilege.

Overview

ZRoot

ZRoot is a library that makes it easy to use root on Android, such as calling system service with root privilege.

Usage

See sample or user guide below.

Hidden API

Before using ZRoot, your project needs a hidden_api module to provide some hidden API.

Create a module named hidden_api, add classes that you need into the module, like IActivityManager ServiceManager.

Add dependency to your application module:

compileOnly project(path: ':hidden_api')

Add Dependency

implementation 'waiting to publish...'

Start ZRoot

/**
 * create a instance
 */
val zRoot = ZRoot(this)

/**
 * start by blocked api with 5000ms timeout
 * return true if succeed
 */
val succeed = zRoot.startBlock(5000)

/**
 * start by async api with 5000ms timeout
 */
zRoot.start(5000) { it ->
    //it will be true if succeed
}

Call system service

/**
 * get remote service binder of activity
 * it is a proxy with root to ServiceManager.getService("activity")
 */
val service = zRoot.getRemoteService("activity")

/**
 * convert to IActivityManager
 */
val mAm = IActivityManager.Stub.asInterface(service)

/**
 * call remote api
 * mAm.broadcastIntent...
 * mAm.startActivity...
 */

Call ContentProvider

/*
 * get ContentProvider from activity service via root
 */
val authority = "settings"
val holder = mAm.getContentProviderExternal(authority, 0, null,null)

/**
 * it equivalent to:
 *     settings put secure accessibility_enabled 1
 * via root user
 */
val bundle = Bundle()
bundle.putString("value", "1")
zRoot.getExecutor()!!.callContentProvider(
    holder.provider.asBinder(),
    "android",
    authority,
    "PUT_secure",
    "accessibility_enabled",
    bundle
)

Run custom code(service) on remote root process

See ZRoot-builder.

AndroidHiddenApiBypass

We need to use hidden APIs like IActivityManager, ServiceManager, etc. This kind of operation will be blocked from Android 9(P), using AndroidHiddenApiBypass to solve it

Run the demo app

  1. Download source code

    git clone --recurse-submodules [email protected]:gogogoghost/ZRoot.git

    Be sure the submodule(builder) was downloaded.

  2. Enter the ZRoot/builder directory and run the following command.

    For Linux: ./gradlew uploadArchives

    For Windows: gradlew.bat uploadArchives

  3. Open the project with Android Studio, and you can run the app module on your device that had root privilege.

Contribute

There are 4 modules in the project: app, hidden_api, runner, sdk.

app: It's a demo application to show the sample code.

hidden_api: If you often code with some root privilege, you probably know what a hidden API is. Otherwise, ignore it, and good luck.

runner: This module is used to help sdk to run remote code with root privilege.

sdk: Here is the core of project.

Waiting to be added more details...

You might also like...
Simple API to perform AES encryption on Android. This is the Android counterpart to the AESCrypt library Ruby and Obj-C (with the same weak security defaults :( ) created by Gurpartap Singh. https://github.com/Gurpartap/aescrypt

AESCrypt-Android Simple API to perform AES encryption on Android with no dependancies. This is the Android counterpart to the AESCrypt library Ruby an

Signal Protocol library for Java/Android

Overview A ratcheting forward secrecy protocol that works in synchronous and asynchronous messaging environments. PreKeys This protocol uses a concept

Grab’n Run, a simple and effective Java Library for Android projects to secure dynamic code loading.
Grab’n Run, a simple and effective Java Library for Android projects to secure dynamic code loading.

Grab’n Run, a simple and effective Java Library for Android projects to secure dynamic code loading.

A simple library that can help you detect if you app is modded or tampered with
A simple library that can help you detect if you app is modded or tampered with

Android Tamper Detector A simple library that can help you detect if you app is modded or tampered with. This adds a security level that makes it diff

Dex manipulation library

dexterity Description dexterity is a C library intended for manipulation and analysis of DEX files. It has python bindings for all basic DEX structure

If you have trouble pinning your custom icon to Launcher dynamically, try this library

CustomIconHelperX If you have trouble pinning your custom icon to Launcher dynam

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.
BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

A collection of android security related resources

android-security-awesome A collection of android security related resources. Tools Academic/Research/Publications/Books Exploits/Vulnerabilities/Bugs

Owner
null
PermissionX is an extension Android library that makes Android runtime permission request extremely easy

PermissionX is an extension Android library that makes Android runtime permission request extremely easy. You can use it for basic pe

Lin Guo 2.9k Dec 28, 2022
🔓 Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

?? Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

Madalin Valceleanu 327 Dec 30, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Dec 29, 2022
Android Malware (Analysis | Scoring) System

An Obfuscation-Neglect Android Malware Scoring System Quark-Engine is also bundled with Kali Linux, BlackArch. A trust-worthy, practical tool that's r

Quark-Engine 999 Dec 20, 2022
This app will show grid overlay over whole system which helps you to verify your excellent app design.

GridWichterle for Android This app will show grid overlay over whole system which helps you to verify your excellent app design. Download: What is the

Inmite s.r.o. 408 Dec 29, 2022
The Spigot plugin counterpart of the overly complex SSN.gg authentication system

Atreus The Spigot plugin counterpart of the overly complex SSN.gg authentication system. Building Make sure you have both Maven and JDK installed (ver

servidor sem nome 3 Dec 16, 2022
MiHawk 🦅👁️ is simple and secure 🔒 Android Library to store and retrieve pair of key-value data with encryption , internally it use jetpack DataStore Preferences 💽 to store data.

MiHawk MiHawk ?? ??️ is simple and secure ?? Android Library to store and retrieve pair of key-value data with encryption , internally it use jetpack

Nedal Hasan Ibrahem 5 Sep 3, 2022
CLI tool for decompiling Android apps to Java. It does resources! It does Java! Its real easy!

Easy-as-pie Android Decompiler Why One stop shop I got pretty tired of decompiling Android apps with a bunch of steps that I had to remember all the t

Alex Davis 619 Dec 27, 2022
a version of the official Android openssl setup to build standalone for use in app

OpenSSL on the Android platform. --- The code in this directory is based on $OPENSSL_VERSION in the file openssl.version. See patches/README for more

Guardian Project 371 Dec 8, 2022
Xposed OneLineClock - Always use one line clock on Android 12 lock screen

Xposed OneLineClock - Always use one line clock on Android 12 lock screen

null 3 Feb 3, 2022