cordova-plugin-iroot
Advanced tools
+4
-0
@@ -5,2 +5,6 @@ # Cordova Jailbreak/Root Detection Plugin | ||
| ### v2.1.0 | ||
| - Add Check by Methods and Remove Check isRunningOnEmulator by default (https://github.com/WuglyakBolgoink/cordova-plugin-iroot/pull/43) | ||
| ### v2.0.0 | ||
@@ -7,0 +11,0 @@ |
+2
-2
| { | ||
| "name": "cordova-plugin-iroot", | ||
| "version": "2.0.2", | ||
| "version": "2.1.0", | ||
| "description": "Cordova Jailbreak/Root Detection Plugin for Apache Cordova", | ||
@@ -37,3 +37,3 @@ "types": "./types/index.d.ts", | ||
| ], | ||
| "author": "Wuglyak Bolgoink (info@cyberkatze.de)", | ||
| "author": "Elderov Ali (info@cyberkatze.de)", | ||
| "license": "MIT", | ||
@@ -40,0 +40,0 @@ "bugs": { |
+2
-2
| <?xml version='1.0' encoding='UTF-8'?> | ||
| <plugin id="cordova-plugin-iroot" version="2.0.2" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <plugin id="cordova-plugin-iroot" version="2.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <name>iRoot</name> | ||
| <author>Wuglyak Bolgoink (info@cyberkatze.de)</author> | ||
| <author>Elderov Ali (info@cyberkatze.de)</author> | ||
@@ -6,0 +6,0 @@ <description>Cordova Jailbreak/Root Detection Plugin</description> |
+2
-0
@@ -94,2 +94,4 @@ ![version][version-shield] | ||
| - https://github.com/Stericson/RootTools/tree/master/src/main/java/com/stericson/RootTools | ||
| 5. Frida detect | ||
| 5. Magestic detect | ||
@@ -96,0 +98,0 @@ [license-shield]:https://img.shields.io/github/license/WuglyakBolgoink/cordova-plugin-iroot?style=flat |
@@ -11,3 +11,32 @@ package de.cyberkatze.iroot; | ||
| ACTION_IS_ROOTED("isRooted"), | ||
| ACTION_IS_ROOTED_WITH_BUSY_BOX("isRootedWithBusyBox"); | ||
| ACTION_IS_ROOTED_WITH_BUSY_BOX("isRootedWithBusyBox"), | ||
| ACTION_DETECTROOTMANAGEMENTAPPS("detectRootManagementApps"), | ||
| ACTION_DETECTPOTENTIALLYDANGEROUSAPPS("detectPotentiallyDangerousApps"), | ||
| ACTION_DETECTTESTKEYS("detectTestKeys"), | ||
| ACTION_CHECKFORBUSYBOXBINARY("checkForBusyBoxBinary"), | ||
| ACTION_CHECKFORSUBINARY("checkForSuBinary"), | ||
| ACTION_CHECKSUEXISTS("checkSuExists"), | ||
| ACTION_CHECKFORRWPATHS("checkForRWPaths"), | ||
| ACTION_CHECKFORDANGEROUSPROPS("checkForDangerousProps"), | ||
| ACTION_CHECKFORROOTNATIVE("checkForRootNative"), | ||
| ACTION_DETECTROOTCLOAKINGAPPS("detectRootCloakingApps"), | ||
| ACTION_ISSELINUXFLAGINENABLED("isSelinuxFlagInEnabled"), | ||
| ACTION_ISEXISTBUILDTAGS("isExistBuildTags"), | ||
| ACTION_DOESSUPERUSERAPKEXIST("doesSuperuserApkExist"), | ||
| ACTION_ISEXISTSUPATH("isExistSUPath"), | ||
| ACTION_CHECKDIRPERMISSIONS("checkDirPermissions"), | ||
| ACTION_CHECKEXECUTINGCOMMANDS("checkExecutingCommands"), | ||
| ACTION_CHECKINSTALLEDPACKAGES("checkInstalledPackages"), | ||
| ACTION_CHECKFOROVERTHEAIRCERTIFICATES("checkforOverTheAirCertificates"), | ||
| ACTION_ISRUNNINGONEMULATOR("isRunningOnEmulator"), | ||
| ACTION_SIMPLECHECKEMULATOR("simpleCheckEmulator"), | ||
| ACTION_SIMPLECHECKSDKBF86("simpleCheckSDKBF86"), | ||
| ACTION_SIMPLECHECKQRREFPH("simpleCheckQRREFPH"), | ||
| ACTION_SIMPLECHECKBUILD("simpleCheckBuild"), | ||
| ACTION_CHECKGENYMOTION("checkGenymotion"), | ||
| ACTION_CHECKGENERIC("checkGeneric"), | ||
| ACTION_CHECKGOOGLESDK("checkGoogleSDK"), | ||
| ACTION_TOGETDEVICEINFO("togetDeviceInfo"), | ||
| ACTION_IS_ROOTED_WITH_EMULATOR("isRootedWithEmulator"), | ||
| ACTION_IS_ROOTED_WITH_BUSY_BOX_WITH_EMULATOR("isRootedWithBusyBoxWithEmulator"); | ||
@@ -37,2 +66,2 @@ private final String name; | ||
| } | ||
| } |
@@ -12,2 +12,4 @@ package de.cyberkatze.iroot; | ||
| import java.util.List; | ||
| import org.json.JSONObject; | ||
| import org.json.JSONException; | ||
@@ -26,2 +28,28 @@ public class InternalRootDetection { | ||
| boolean c7 = checkforOverTheAirCertificates(); | ||
| // boolean c8 = isRunningOnEmulator(); | ||
| LOG.d(Constants.LOG_TAG, "check c1 = isExistBuildTags: " + c1); | ||
| LOG.d(Constants.LOG_TAG, "check c2 = doesSuperuserApkExist: " + c2); | ||
| LOG.d(Constants.LOG_TAG, "check c3 = isExistSUPath: " + c3); | ||
| LOG.d(Constants.LOG_TAG, "check c4 = checkDirPermissions: " + c4); | ||
| LOG.d(Constants.LOG_TAG, "check c5 = checkExecutingCommands: " + c5); | ||
| LOG.d(Constants.LOG_TAG, "check c6 = checkInstalledPackages: " + c6); | ||
| LOG.d(Constants.LOG_TAG, "check c7 = checkforOverTheAirCertificates: " + c7); | ||
| // LOG.d(Constants.LOG_TAG, "check c8 = isRunningOnEmulator: " + c8); | ||
| boolean result = c1 || c2 || c3 || c4 || c5 || c6 || c7; | ||
| LOG.d(Constants.LOG_TAG, String.format("[checkDirPermissions] result: %s", result)); | ||
| return result; | ||
| } | ||
| public boolean isRootedWithEmulator(final Context context) { | ||
| boolean c1 = isExistBuildTags(); | ||
| boolean c2 = doesSuperuserApkExist(); | ||
| boolean c3 = isExistSUPath(); | ||
| boolean c4 = checkDirPermissions(); | ||
| boolean c5 = checkExecutingCommands(); | ||
| boolean c6 = checkInstalledPackages(context); | ||
| boolean c7 = checkforOverTheAirCertificates(); | ||
| boolean c8 = isRunningOnEmulator(); | ||
@@ -45,2 +73,41 @@ | ||
| public boolean WhatisRooted(final String action,final Context context) { | ||
| boolean restest = false; | ||
| switch (action) { | ||
| case "isExistBuildTags": restest = isExistBuildTags(); | ||
| break; | ||
| case "doesSuperuserApkExist": restest = doesSuperuserApkExist(); | ||
| break; | ||
| case "isExistSUPath": restest = isExistSUPath(); | ||
| break; | ||
| case "checkDirPermissions": restest = checkDirPermissions(); | ||
| break; | ||
| case "checkExecutingCommands": restest = checkExecutingCommands(); | ||
| break; | ||
| case "checkInstalledPackages": restest = checkInstalledPackages(context); | ||
| break; | ||
| case "checkforOverTheAirCertificates": restest = checkforOverTheAirCertificates(); | ||
| break; | ||
| case "isRunningOnEmulator": restest = isRunningOnEmulator(); | ||
| break; | ||
| case "simpleCheckEmulator": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| case "simpleCheckSDKBF86": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| case "simpleCheckQRREFPH": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| case "simpleCheckBuild": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| case "checkGenymotion": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| case "checkGeneric": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| case "checkGoogleSDK": restest = WhatisRunningOnEmulator(action); | ||
| break; | ||
| default: LOG.e(Constants.LOG_TAG, String.format("[WhatisRooted] action: %s", action)); | ||
| } | ||
| boolean result = restest; | ||
| return result; | ||
| } | ||
| /** | ||
@@ -245,32 +312,77 @@ * Checks whether any of the system directories are writable or the /data directory is readable. | ||
| */ | ||
| public boolean isRunningOnEmulator() { | ||
| Utils.getDeviceInfo(); | ||
| public boolean isRunningOnEmulator() { | ||
| Utils.getDeviceInfo(); | ||
| boolean simpleCheck = Build.MODEL.contains("Emulator") | ||
| // ||Build.FINGERPRINT.startsWith("unknown") // Meizu Mx Pro will return unknown, so comment it! | ||
| || Build.MODEL.contains("Android SDK built for x86") | ||
| || Build.BOARD.equals("QC_Reference_Phone") //bluestacks | ||
| || Build.HOST.startsWith("Build"); //MSI App Player | ||
| boolean simpleCheck = Build.MODEL.contains("Emulator") | ||
| // ||Build.FINGERPRINT.startsWith("unknown") // Meizu Mx Pro will return unknown, so comment it! | ||
| || Build.MODEL.contains("Android SDK built for x86") | ||
| || Build.BOARD.equals("QC_Reference_Phone") //bluestacks | ||
| || Build.HOST.startsWith("Build"); //MSI App Player | ||
| boolean checkGenymotion = Build.MANUFACTURER.contains("Genymotion"); | ||
| boolean checkGeneric = Build.FINGERPRINT.startsWith("generic") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")); | ||
| boolean checkGoogleSDK = Build.MODEL.contains("google_sdk") || "google_sdk".equals(Build.PRODUCT); | ||
| boolean checkGenymotion = Build.MANUFACTURER.contains("Genymotion"); | ||
| boolean checkGeneric = Build.FINGERPRINT.startsWith("generic") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")); | ||
| boolean checkGoogleSDK = Build.MODEL.contains("google_sdk") || "google_sdk".equals(Build.PRODUCT); | ||
| boolean result = simpleCheck || checkGenymotion || checkGeneric || checkGoogleSDK; | ||
| boolean result = simpleCheck || checkGenymotion || checkGeneric || checkGoogleSDK; | ||
| LOG.d( | ||
| Constants.LOG_TAG, | ||
| String.format( | ||
| "[isRunningOnEmulator] result [%s] => [simpleCheck:%s][checkGenymotion:%s][checkGeneric:%s][checkGoogleSDK:%s]", | ||
| result, | ||
| simpleCheck, | ||
| checkGenymotion, | ||
| checkGeneric, | ||
| checkGoogleSDK | ||
| ) | ||
| ); | ||
| LOG.d( | ||
| Constants.LOG_TAG, | ||
| String.format( | ||
| "[isRunningOnEmulator] result [%s] => [simpleCheck:%s][checkGenymotion:%s][checkGeneric:%s][checkGoogleSDK:%s]", | ||
| result, | ||
| simpleCheck, | ||
| checkGenymotion, | ||
| checkGeneric, | ||
| checkGoogleSDK | ||
| ) | ||
| ); | ||
| return result; | ||
| } | ||
| return result; | ||
| } | ||
| public boolean WhatisRunningOnEmulator(final String action) { | ||
| Utils.getDeviceInfo(); | ||
| boolean result = false; | ||
| switch (action) { | ||
| case "simpleCheckEmulator": result = Build.MODEL.contains("Emulator"); | ||
| break; | ||
| case "simpleCheckSDKBF86": result = Build.MODEL.contains("Android SDK built for x86"); | ||
| break; | ||
| case "simpleCheckQRREFPH": result = Build.BOARD.equals("QC_Reference_Phone"); | ||
| break; | ||
| case "simpleCheckBuild": result = Build.HOST.startsWith("Build"); | ||
| break; | ||
| case "checkGenymotion": result = Build.MANUFACTURER.contains("Genymotion"); | ||
| break; | ||
| case "checkGeneric": result = Build.FINGERPRINT.startsWith("generic") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")); | ||
| break; | ||
| case "checkGoogleSDK": result = Build.MODEL.contains("google_sdk") || "google_sdk".equals(Build.PRODUCT); | ||
| break; | ||
| } | ||
| return result; | ||
| } | ||
| public JSONObject togetDeviceInfo() throws JSONException { | ||
| Utils.getDeviceInfo(); | ||
| JSONObject objBuild = new JSONObject(); | ||
| objBuild.put("DEVICE",Build.DEVICE); | ||
| objBuild.put("MODEL",Build.MODEL); | ||
| objBuild.put("MANUFACTURER",Build.MANUFACTURER); | ||
| objBuild.put("BRAND",Build.BRAND); | ||
| objBuild.put("BOARD",Build.BOARD); | ||
| objBuild.put("HARDWARE",Build.HARDWARE); | ||
| objBuild.put("PRODUCT",Build.PRODUCT); | ||
| objBuild.put("FINGERPRINT",Build.FINGERPRINT); | ||
| objBuild.put("HOST",Build.HOST); | ||
| // Add More info | ||
| objBuild.put("USER",Build.USER); | ||
| objBuild.put("OSNAME",System.getProperty("os.name")); | ||
| objBuild.put("OSVERSION",System.getProperty("os.version")); | ||
| objBuild.put("V.INCREMENTAL",Build.VERSION.INCREMENTAL); | ||
| objBuild.put("V.RELEASE",Build.VERSION.RELEASE); | ||
| objBuild.put("V.SDK_INT",Build.VERSION.SDK_INT); | ||
| return objBuild; | ||
| } | ||
| // TODO: https://github.com/tansiufang54/fncgss/blob/master/app/src/main/java/co/id/franknco/controller/RootUtil.java#L126 | ||
@@ -277,0 +389,0 @@ // private boolean checkServerSocket() { |
@@ -13,2 +13,3 @@ package de.cyberkatze.iroot; | ||
| import org.json.JSONArray; | ||
| import org.json.JSONObject; | ||
| import org.json.JSONException; | ||
@@ -80,2 +81,99 @@ | ||
| return true; | ||
| case ACTION_IS_ROOTED_WITH_EMULATOR: | ||
| cordova.getThreadPool().execute(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| PluginResult result; | ||
| try { | ||
| result = checkIsRootedWithEmulator(args, callbackContext); | ||
| } catch (Exception error) { | ||
| result = new PluginResult(PluginResult.Status.ERROR, error.toString()); | ||
| } | ||
| callbackContext.sendPluginResult(result); | ||
| } | ||
| }); | ||
| return true; | ||
| case ACTION_IS_ROOTED_WITH_BUSY_BOX_WITH_EMULATOR: | ||
| cordova.getThreadPool().execute(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| PluginResult result; | ||
| try { | ||
| result = checkIsRootedWithBusyBoxWithEmulator(args, callbackContext); | ||
| } catch (Exception error) { | ||
| result = new PluginResult(PluginResult.Status.ERROR, error.toString()); | ||
| } | ||
| callbackContext.sendPluginResult(result); | ||
| } | ||
| }); | ||
| return true; | ||
| case ACTION_DETECTROOTMANAGEMENTAPPS: | ||
| case ACTION_DETECTPOTENTIALLYDANGEROUSAPPS: | ||
| case ACTION_DETECTTESTKEYS: | ||
| case ACTION_CHECKFORBUSYBOXBINARY: | ||
| case ACTION_CHECKFORSUBINARY: | ||
| case ACTION_CHECKSUEXISTS: | ||
| case ACTION_CHECKFORRWPATHS: | ||
| case ACTION_CHECKFORDANGEROUSPROPS: | ||
| case ACTION_CHECKFORROOTNATIVE: | ||
| case ACTION_DETECTROOTCLOAKINGAPPS: | ||
| case ACTION_ISSELINUXFLAGINENABLED: | ||
| case ACTION_ISEXISTBUILDTAGS: | ||
| case ACTION_DOESSUPERUSERAPKEXIST: | ||
| case ACTION_ISEXISTSUPATH: | ||
| case ACTION_CHECKDIRPERMISSIONS: | ||
| case ACTION_CHECKEXECUTINGCOMMANDS: | ||
| case ACTION_CHECKINSTALLEDPACKAGES: | ||
| case ACTION_CHECKFOROVERTHEAIRCERTIFICATES: | ||
| case ACTION_ISRUNNINGONEMULATOR: | ||
| case ACTION_SIMPLECHECKEMULATOR: | ||
| case ACTION_SIMPLECHECKSDKBF86: | ||
| case ACTION_SIMPLECHECKQRREFPH: | ||
| case ACTION_SIMPLECHECKBUILD: | ||
| case ACTION_CHECKGENYMOTION: | ||
| case ACTION_CHECKGENERIC: | ||
| case ACTION_CHECKGOOGLESDK: | ||
| cordova.getThreadPool().execute(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| PluginResult result; | ||
| try { | ||
| result = WhatIsRooted(args, callbackContext, action); | ||
| } catch (Exception error) { | ||
| result = new PluginResult(PluginResult.Status.ERROR, error.toString()); | ||
| } | ||
| callbackContext.sendPluginResult(result); | ||
| } | ||
| }); | ||
| return true; | ||
| case ACTION_TOGETDEVICEINFO: | ||
| cordova.getThreadPool().execute(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| PluginResult result; | ||
| try { | ||
| result = togetDeviceInfo(args, callbackContext); | ||
| } catch (Exception error) { | ||
| result = new PluginResult(PluginResult.Status.ERROR, error.toString()); | ||
| } | ||
| callbackContext.sendPluginResult(result); | ||
| } | ||
| }); | ||
| return true; | ||
| default: | ||
@@ -94,6 +192,96 @@ cordova.getActivity().runOnUiThread(new Runnable() { | ||
| private PluginResult WhatIsRooted(final JSONArray args, final CallbackContext callbackContext, final String action) { | ||
| try { | ||
| Context context = this.cordova.getActivity().getApplicationContext(); | ||
| RootBeer rootBeer = new RootBeer(context); | ||
| boolean WhatisRooted; | ||
| switch (action) { | ||
| case "detectRootManagementApps": | ||
| WhatisRooted = rootBeer.detectRootManagementApps(); | ||
| break; | ||
| case "detectPotentiallyDangerousApps": | ||
| WhatisRooted = rootBeer.detectPotentiallyDangerousApps(); | ||
| break; | ||
| case "detectTestKeys": | ||
| WhatisRooted = rootBeer.detectTestKeys(); | ||
| break; | ||
| case "checkForBusyBoxBinary": | ||
| WhatisRooted = rootBeer.checkForBusyBoxBinary(); | ||
| break; | ||
| case "checkForSuBinary": | ||
| WhatisRooted = rootBeer.checkForSuBinary(); | ||
| break; | ||
| case "checkSuExists": | ||
| WhatisRooted = rootBeer.checkSuExists(); | ||
| break; | ||
| case "checkForRWPaths": | ||
| WhatisRooted = rootBeer.checkForRWPaths(); | ||
| break; | ||
| case "checkForDangerousProps": | ||
| WhatisRooted = rootBeer.checkForDangerousProps(); | ||
| break; | ||
| case "checkForRootNative": | ||
| WhatisRooted = rootBeer.checkForRootNative(); | ||
| break; | ||
| case "detectRootCloakingApps": | ||
| WhatisRooted = rootBeer.detectRootCloakingApps(); | ||
| break; | ||
| case "isSelinuxFlagInEnabled": | ||
| WhatisRooted = Utils.isSelinuxFlagInEnabled(); | ||
| break; | ||
| default: WhatisRooted = this.internalRootDetection.WhatisRooted(action, context); | ||
| } | ||
| boolean toWhatisRooted = WhatisRooted; | ||
| LOG.e(Constants.LOG_TAG, "[WhatIsRooted] "+action+": " + toWhatisRooted); | ||
| return new PluginResult(Status.OK, toWhatisRooted); | ||
| } catch (Exception error) { | ||
| return Utils.getPluginResultError("WhatIsRooted", error); | ||
| } | ||
| } | ||
| private PluginResult togetDeviceInfo(final JSONArray args, final CallbackContext callbackContext) { | ||
| try { | ||
| Context context = this.cordova.getActivity().getApplicationContext(); | ||
| JSONObject MyDeviceInfo = this.internalRootDetection.togetDeviceInfo(); | ||
| LOG.e(Constants.LOG_TAG, "[togetDeviceInfo] MyDeviceInfo: " + MyDeviceInfo.toString()); | ||
| return new PluginResult(Status.OK, MyDeviceInfo); | ||
| } catch (Exception error) { | ||
| return Utils.getPluginResultError("MyDeviceInfo", error); | ||
| } | ||
| } | ||
| /** | ||
| * Check with rootBeer and with internal checks. | ||
| */ | ||
| private PluginResult checkIsRooted(final JSONArray args, final CallbackContext callbackContext) { | ||
| private PluginResult checkIsRooted(final JSONArray args, final CallbackContext callbackContext) { | ||
| try { | ||
| Context context = this.cordova.getActivity().getApplicationContext(); | ||
| RootBeer rootBeer = new RootBeer(context); | ||
| boolean checkRootBeer = rootBeer.isRooted(); | ||
| boolean checkInternal = this.internalRootDetection.isRooted(context); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRooted] checkRootBeer: " + checkRootBeer); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRooted] checkInternal: " + checkInternal); | ||
| boolean isRooted = checkRootBeer || checkInternal; | ||
| // boolean isRooted = checkRootBeer; | ||
| return new PluginResult(Status.OK, isRooted); | ||
| } catch (Exception error) { | ||
| return Utils.getPluginResultError("checkIsRooted", error); | ||
| } | ||
| } | ||
| /** | ||
| * Check with rootBeer with BusyBox and with internal checks. | ||
| */ | ||
| private PluginResult checkIsRootedWithBusyBox(final JSONArray args, final CallbackContext callbackContext) { | ||
| try { | ||
@@ -103,7 +291,7 @@ Context context = this.cordova.getActivity().getApplicationContext(); | ||
| boolean checkRootBeer = rootBeer.isRooted(); | ||
| boolean checkRootBeer = rootBeer.isRootedWithBusyBoxCheck(); | ||
| boolean checkInternal = this.internalRootDetection.isRooted(context); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRooted] checkRootBeer: " + checkRootBeer); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRooted] checkInternal: " + checkInternal); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithBusyBox] checkRootBeer: " + checkRootBeer); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithBusyBox] checkInternal: " + checkInternal); | ||
@@ -114,3 +302,3 @@ boolean isRooted = checkRootBeer || checkInternal; | ||
| } catch (Exception error) { | ||
| return Utils.getPluginResultError("checkIsRooted", error); | ||
| return Utils.getPluginResultError("checkIsRootedWithBusyBox", error); | ||
| } | ||
@@ -120,5 +308,29 @@ } | ||
| /** | ||
| * Check with rootBeer without BusyBox. | ||
| * Check with rootBeer and with internal checks and with isRunningOnEmulator | ||
| */ | ||
| private PluginResult checkIsRootedWithBusyBox(final JSONArray args, final CallbackContext callbackContext) { | ||
| private PluginResult checkIsRootedWithEmulator(final JSONArray args, final CallbackContext callbackContext) { | ||
| try { | ||
| Context context = this.cordova.getActivity().getApplicationContext(); | ||
| RootBeer rootBeer = new RootBeer(context); | ||
| boolean checkRootBeer = rootBeer.isRooted(); | ||
| boolean checkInternal = this.internalRootDetection.isRootedWithEmulator(context); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithEmulator] checkRootBeer: " + checkRootBeer); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithEmulator] checkInternal: " + checkInternal); | ||
| boolean isRooted = checkRootBeer || checkInternal; | ||
| // boolean isRooted = checkRootBeer; | ||
| return new PluginResult(Status.OK, isRooted); | ||
| } catch (Exception error) { | ||
| return Utils.getPluginResultError("checkIsRootedWithEmulator", error); | ||
| } | ||
| } | ||
| /** | ||
| * Check with rootBeer with BusyBox and with internal checks and with isRunningOnEmulator | ||
| */ | ||
| private PluginResult checkIsRootedWithBusyBoxWithEmulator(final JSONArray args, final CallbackContext callbackContext) { | ||
| try { | ||
@@ -129,6 +341,6 @@ Context context = this.cordova.getActivity().getApplicationContext(); | ||
| boolean checkRootBeer = rootBeer.isRootedWithBusyBoxCheck(); | ||
| boolean checkInternal = this.internalRootDetection.isRooted(context); | ||
| boolean checkInternal = this.internalRootDetection.isRootedWithEmulator(context); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithBusyBox] checkRootBeer: " + checkRootBeer); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithBusyBox] checkInternal: " + checkInternal); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithBusyBoxWithEmulator] checkRootBeer: " + checkRootBeer); | ||
| LOG.d(Constants.LOG_TAG, "[checkIsRootedWithBusyBoxWithEmulator] checkInternal: " + checkInternal); | ||
@@ -139,3 +351,3 @@ boolean isRooted = checkRootBeer || checkInternal; | ||
| } catch (Exception error) { | ||
| return Utils.getPluginResultError("checkIsRootedWithBusyBox", error); | ||
| return Utils.getPluginResultError("checkIsRootedWithBusyBoxWithEmulator", error); | ||
| } | ||
@@ -142,0 +354,0 @@ } |
@@ -11,5 +11,27 @@ package de.cyberkatze.iroot; | ||
| import java.io.InputStreamReader; | ||
| import java.lang.reflect.Method; | ||
| public class Utils { | ||
| private Utils() throws InstantiationException { | ||
| throw new InstantiationException("This class is not for instantiation"); | ||
| } | ||
| /** | ||
| * In Development - an idea of ours was to check the if selinux is enforcing - this could be disabled for some rooting apps | ||
| * Checking for selinux mode | ||
| * | ||
| * @return true if selinux enabled | ||
| */ | ||
| public static boolean isSelinuxFlagInEnabled() { | ||
| try { | ||
| Class<?> c = Class.forName("android.os.SystemProperties"); | ||
| Method get = c.getMethod("get", String.class); | ||
| String selinux = (String) get.invoke(c, "ro.build.selinux"); | ||
| return "1".equals(selinux); | ||
| } catch (Exception ignored) { | ||
| } | ||
| return false; | ||
| } | ||
| /** | ||
@@ -16,0 +38,0 @@ * Helper function that logs the error and then calls the error callback. |
+58
-0
@@ -9,4 +9,62 @@ /** | ||
| isRootedWithBusyBox(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| detectRootManagementApps(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| detectPotentiallyDangerousApps(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| detectTestKeys(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkForBusyBoxBinary(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkForSuBinary(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkSuExists(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkForRWPaths(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkForDangerousProps(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkForRootNative(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| detectRootCloakingApps(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| isSelinuxFlagInEnabled(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| isExistBuildTags(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| doesSuperuserApkExist(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| isExistSUPath(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkDirPermissions(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkExecutingCommands(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkInstalledPackages(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkforOverTheAirCertificates(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| isRunningOnEmulator(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| simpleCheckEmulator(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| simpleCheckSDKBF86(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| simpleCheckQRREFPH(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| simpleCheckBuild(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkGenymotion(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkGeneric(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| checkGoogleSDK(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| togetDeviceInfo(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| isRootedWithEmulator(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| isRootedWithBusyBoxWithEmulator(onSuccess: (boolean) => void, onError: (any) => void): void; | ||
| } | ||
| declare var IRoot: IRootPlugin; |
+87
-0
@@ -9,3 +9,90 @@ var exec = require('cordova/exec'); | ||
| exec(onSuccess, onError, 'IRoot', 'isRootedWithBusyBox', []); | ||
| }, | ||
| detectRootManagementApps: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'detectRootManagementApps', []); | ||
| }, | ||
| detectPotentiallyDangerousApps: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'detectPotentiallyDangerousApps', []); | ||
| }, | ||
| detectTestKeys: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'detectTestKeys', []); | ||
| }, | ||
| checkForBusyBoxBinary: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkForBusyBoxBinary', []); | ||
| }, | ||
| checkForSuBinary: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkForSuBinary', []); | ||
| }, | ||
| checkSuExists: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkSuExists', []); | ||
| }, | ||
| checkForRWPaths: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkForRWPaths', []); | ||
| }, | ||
| checkForDangerousProps: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkForDangerousProps', []); | ||
| }, | ||
| checkForRootNative: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkForRootNative', []); | ||
| }, | ||
| detectRootCloakingApps: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'detectRootCloakingApps', []); | ||
| }, | ||
| isSelinuxFlagInEnabled: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'isSelinuxFlagInEnabled', []); | ||
| }, | ||
| isExistBuildTags: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'isExistBuildTags', []); | ||
| }, | ||
| doesSuperuserApkExist: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'doesSuperuserApkExist', []); | ||
| }, | ||
| isExistSUPath: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'isExistSUPath', []); | ||
| }, | ||
| checkDirPermissions: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkDirPermissions', []); | ||
| }, | ||
| checkExecutingCommands: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkExecutingCommands', []); | ||
| }, | ||
| checkInstalledPackages: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkInstalledPackages', []); | ||
| }, | ||
| checkforOverTheAirCertificates: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkforOverTheAirCertificates', []); | ||
| }, | ||
| isRunningOnEmulator: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'isRunningOnEmulator', []); | ||
| }, | ||
| simpleCheckEmulator: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'simpleCheckEmulator', []); | ||
| }, | ||
| simpleCheckSDKBF86: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'simpleCheckSDKBF86', []); | ||
| }, | ||
| simpleCheckQRREFPH: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'simpleCheckQRREFPH', []); | ||
| }, | ||
| simpleCheckBuild: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'simpleCheckBuild', []); | ||
| }, | ||
| checkGenymotion: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkGenymotion', []); | ||
| }, | ||
| checkGeneric: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkGeneric', []); | ||
| }, | ||
| checkGoogleSDK: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'checkGoogleSDK', []); | ||
| }, | ||
| togetDeviceInfo: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'togetDeviceInfo', []); | ||
| }, | ||
| isRootedWithEmulator: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'isRootedWithEmulator', []); | ||
| }, | ||
| isRootedWithBusyBoxWithEmulator: function(onSuccess, onError) { | ||
| exec(onSuccess, onError, 'IRoot', 'isRootedWithBusyBoxWithEmulator', []); | ||
| } | ||
| }; |
106973
27.11%961
86.24%109
1.87%