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