欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

安卓检测root代码

程序员文章站 2022-05-01 19:38:37
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 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”);
}

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;
}

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”);
}

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;
}

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;
}

本文地址:https://blog.csdn.net/c_kongfei/article/details/112577630

相关标签: 安卓逆向