RootBeer Android Library

repository·master·Indexed 25 days ago

https://github.com/scottyab/rootbeer

An Android library used to detect if a device has been rooted using a combination of Java and Native checks. It provides methods such as isRooted() and isRootedWithBusyBoxCheck() to indicate root status, though it notes that results can be bypassed by root cloaking tools.

Tokens
627
Snippets
4
Records
6
Agent score
34%

What's inside RootBeer

  1. Install RootBeer via Gradle

    master

    To include RootBeer in your Android project, add the following dependency to your build.gradle file. The library is available on Maven Central.

    dependencies {
        implementation 'com.scottyab:rootbeer-lib:0.1.2'
    }
  2. Perform basic root detection with RootBeer

    master

    Initialize a RootBeer instance with your application context and call isRooted().

    Note: It is highly recommended to call isRooted() from a background thread because the check involves disk I/O operations.

    RootBeer rootBeer = new RootBeer(context);
    if (rootBeer.isRooted()) {
        //we found indication of root
    } else {
        //we didn't find indication of root
    }
  3. Detect BusyBox to avoid false positives

    master

    By default, isRooted() does not check for the BusyBox binary to avoid false positives on certain devices (like OnePlus, Moto E, and OPPO R9m) where BusyBox may be present in the stock ROM.

    If you specifically need to detect the BusyBox binary, use isRootedWithBusyBoxCheck() or call checkForBinary(BINARY_BUSYBOX) individually.

    rootBeer.isRootedWithBusyBoxCheck();
  4. Reference: Native root detection methods

    master

    RootBeer includes native checks which are typically harder to cloak than Java checks. Some root cloaking apps attempt to bypass these by blocking the loading of native libraries containing specific keywords.

    | Method Name | Description |
    |--------------------|-----------------------------------------------------------------------------|
    | `checkForSuBinary` | Checks for the presence of the `su` binary, typically used to elevate privileges. |