Java Code Examples for com.scottyab.rootbeer.RootBeer#checkSuExists()

The following examples show how to use com.scottyab.rootbeer.RootBeer#checkSuExists() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorizationTypeActivity.java    From guarda-android-wallets with GNU General Public License v3.0 7 votes vote down vote up
private void isRootDevice() {
    try {
        RootBeer rb = new RootBeer(this);
        if (rb.detectRootCloakingApps()
                || rb.checkForSuBinary()
                || rb.checkForDangerousProps()
                || rb.checkForRWPaths()
                || rb.checkSuExists()
                || rb.checkForRootNative()) {
            showRootDialog();
        }
    } catch (Exception e) {
        showRootDialog();
        e.printStackTrace();
    }
}
 
Example 2
Source File: CheckRootTask.java    From rootbeer with Apache License 2.0 4 votes vote down vote up
@Override
protected Boolean doInBackground(Boolean... params) {
    RootBeer check = new RootBeer(mContext);
    check.checkForNativeLibraryReadAccess();
    check.setLogging(true);

    for (int i = 0; i < 90; i++) {
        try {
            Thread.sleep(SLEEP_TIME);
        } catch (InterruptedException e) {

        }
        switch (i) {
            case 8:
                mIsCheck = check.detectRootManagementApps();
                Log.d(TAG, "Root Management Apps " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 16:
                mIsCheck = check.detectPotentiallyDangerousApps();
                Log.d(TAG, "PotentiallyDangerousApps " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 24:
                mIsCheck = check.detectTestKeys();
                Log.d(TAG, "TestKeys " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 32:
                mIsCheck = check.checkForBusyBoxBinary();
                Log.d(TAG, "BusyBoxBinary " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 40:
                mIsCheck = check.checkForSuBinary();
                Log.d(TAG, "SU Binary " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 48:
                mIsCheck = check.checkSuExists();
                Log.d(TAG, "2nd SU Binary check " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 56:
                mIsCheck = check.checkForRWPaths();
                Log.d(TAG, "ForRWPaths " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 64:
                mIsCheck = check.checkForDangerousProps();
                Log.d(TAG, "DangerousProps " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 72:
                mIsCheck = check.checkForRootNative();
                Log.d(TAG, "Root via native check " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 80:
                mIsCheck = check.detectRootCloakingApps();
                Log.d(TAG, "RootCloakingApps " + (mIsCheck ? "detected" : "not detected"));
                break;
            case 88:
                mIsCheck = Utils.isSelinuxFlagInEnabled();
                Log.d(TAG, "Selinux Flag Is Enabled " + (mIsCheck ? "true" : "false"));
                break;
            case 89:
                mIsCheck = check.checkForMagiskBinary();
                Log.d(TAG, "Magisk " + (mIsCheck ? "deteced" : "not deteced"));
                break;
        }
        publishProgress(i);
    }
    return check.isRooted();
}