Created
April 15, 2022 08:41
-
-
Save massimilianochiodi/642f2e3fa0c97ecfd5672839bffe2f0d to your computer and use it in GitHub Desktop.
Simple verify if phone is rooted ( java )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean findBinary(String binaryName) { | |
boolean found = false; | |
String[] places = { "/sbin/", "/system/bin/", "/system/xbin/", | |
"/data/local/xbin/", "/data/local/bin/", | |
"/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/" }; | |
for (String where : places) { | |
if (new File(where + binaryName).exists()) { | |
found = true; | |
break; | |
} | |
} | |
return found; | |
} | |
private static boolean isRooted() { | |
return findBinary("su"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment