1.检测路径1
public boolean c() {
String[] strArr = {"/system/bin/", "/system/xbin/", "/system/sbin/", "/sbin/", "/vendor/bin/"};
int i = 0;
while (i < 5) {
try {
if (new File(strArr[i] + "su").exists()) {
return true;
}
i++;
} catch (Exception e) {
}
}
return false;
}
public String o() {
return a("ro.kernel.qemu", "0");
}
2.检测路径2
public static boolean a() {
String[] strArr = {"/system/xbin/", "/system/bin/", "/system/sbin/", "/sbin/", "/vendor/bin/", "/su/bin/"};
try {
int length = strArr.length;
for (int i = 0; i < length; i++) {
String str = strArr[i] + "su";
if (new File(str).exists()) {
String a = a(new String[]{"ls", "-l", str});
f.b("cyb", "isRooted=" + a);
if (TextUtils.isEmpty(a) || a.indexOf("root") == a.lastIndexOf("root")) {
return false;
}
return true;
}
}
} catch (Exception e) {
}
return false;
}
3.检测属性
public static boolean checkRootMethod1() {
if (PatchProxy.isSupport(new Object[0], null, changeQuickRedirect, true, 3217, new Class[0], Boolean.TYPE)) {
return ((Boolean) PatchProxy.accessDispatch(new Object[0], null, changeQuickRedirect, true, 3217, new Class[0], Boolean.TYPE)).booleanValue();
}
String str = Build.TAGS;
return str != null && str.contains("test-keys");
}
4. 检测路径3
public static boolean checkRootMethod2() {
if (PatchProxy.isSupport(new Object[0], null, changeQuickRedirect, true, 3218, new Class[0], Boolean.TYPE)) {
return ((Boolean) PatchProxy.accessDispatch(new Object[0], null, changeQuickRedirect, true, 3218, new Class[0], Boolean.TYPE)).booleanValue();
}
try {
if (new File("/system/bin/su").exists() || new File("/system/xbin/su").exists()) {
return true;
}
} catch (Exception e) {
}
return false;
}
5.检测包名
public static boolean checkRootMethod3() {
if (PatchProxy.isSupport(new Object[0], null, changeQuickRedirect, true, 3219, new Class[0], Boolean.TYPE)) {
return ((Boolean) PatchProxy.accessDispatch(new Object[0], null, changeQuickRedirect, true, 3219, new Class[0], Boolean.TYPE)).booleanValue();
}
try {
if (new File("/system/app/Superuser.apk").exists()) {
return true;
}
} catch (Exception e) {
}
return false;
}