com.scottyab.rootbeer.RootBeer Java Examples

The following examples show how to use com.scottyab.rootbeer.RootBeer. 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: MainActivity.java    From android-security with Apache License 2.0 7 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);

    client = new GoogleApiClient.Builder(this)
            .addApi(SafetyNet.API)
            .enableAutoManage(this, this)
            .build();

    binding.root.setText(new RootBeer(this).isRooted() ? "Device is rooted" : "Device isn't rooted");
    binding.installation.setText(InstallationChecker.verifyInstaller(this) ? "Installed from Play Store" : "Installed from unknown source");

    binding.enviroment.setText((EnvironmentChecker.alternativeIsEmulator() ? "Running on an emulator" : "Running on a device")
            + (EnvironmentChecker.isDebuggable(this) ? " with debugger" : ""));

    binding.tampering.setText((InstallationChecker.checkPackage(this) ?
            "The package is consistent" : "The package was modified")
            + (SignatureUtils.checkSignature(this) ? " and the signature is ok" : " and the signature was changed!"));

    binding.setController(this);
}
 
Example #3
Source File: RootedCheck.java    From jail-monkey with MIT License 4 votes vote down vote up
private static boolean rootBeerCheck(Context context) {
    RootBeer rootBeer = new RootBeer(context);
    
    return rootBeer.isRootedWithoutBusyBoxCheck();
}
 
Example #4
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();
}