常规root的检查方案

简介: root

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;

}

相关文章
|
消息中间件 运维 Java
【消息中间件】在Docker下安装的RocketMQ,使用mqadmin命令报错解决[10015:signature-failed]
前在Docker下安装了RocketMQ以及他的管理平台,但是管理平台在运维的时候只能满足我们部分的需求,所以为了在集群运维时能够的得心应手,研究了下mqadmin的使用,没想到一开始就遇到了报错,在这里和大家分享下解决的方法。
1654 92
|
大数据 数据管理 Docker
【Datahub系列教程】Datahub入门必学——DatahubCLI之Docker命令详解
【Datahub系列教程】Datahub入门必学——DatahubCLI之Docker命令详解
912 0
|
6月前
|
编解码 虚拟化 Windows
Hyper分辨率调整是确保虚拟机图形表现符合期望的重要步骤,怎么调呢
在Hyper-V中调整虚拟机分辨率是确保图形表现符合预期的重要步骤。首先,通过增强会话模式调整:打开Hyper-V管理器,启用增强会话模式,启动虚拟机后在桌面右键选择“屏幕分辨率”进行设置。其次,在虚拟机内部(Windows系统)右键点击桌面空白处,选择“显示设置”,调整分辨率并应用更改。注意事项包括:确保安装Hyper-V集成服务、以管理员权限操作、注意虚拟机类型兼容性、检查显卡驱动并备份数据。这些步骤能帮助你顺利完成分辨率调整。
|
8月前
|
SQL 存储 关系型数据库
MySQL进阶突击系列(05)突击MVCC核心原理 | 左右护法ReadView视图和undoLog版本链强强联合
2024年小结:感谢阿里云开发者社区每月的分享交流活动,支持持续学习和进步。过去五个月投稿29篇,其中17篇获高分认可。本文详细介绍了MySQL InnoDB存储引擎的MVCC机制,包括数据版本链、readView视图及解决脏读、不可重复读、幻读问题的demo演示。
|
Ubuntu 安全 开发工具
如何在 Ubuntu 20.04 上将用户添加到 sudoers?
如何在 Ubuntu 20.04 上将用户添加到 sudoers?
902 1
如何在 Ubuntu 20.04 上将用户添加到 sudoers?
|
6月前
|
SQL
【YashanDB知识库】使用leading hint调整SQL执行计划后报错YAS-04522 invalid hint leading
【YashanDB知识库】使用leading hint调整SQL执行计划后报错YAS-04522 invalid hint leading
【YashanDB知识库】使用leading hint调整SQL执行计划后报错YAS-04522 invalid hint leading
|
5月前
|
安全 Ubuntu 网络协议
YashanDB安装前操作系统参数调整
本文来自YashanDB官网,主要介绍在Linux环境下安装YashanDB时的系统性能优化配置。内容涵盖服务器hostname设置、关闭交换分区、调整本地端口范围、进程VMA上限及资源限制值、配置大页内存与关闭透明大页等操作。通过这些调整,可提升系统运行效率并避免潜在异常,适用于分布式部署场景,同时提供了具体命令和注意事项以指导用户完成配置。
|
6月前
|
网络安全 数据安全/隐私保护
【YashanDB知识库】YashanDB 单机一主一备自动切换
【YashanDB知识库】YashanDB 单机一主一备自动切换
LabVIEW将 VI 升级到较新的版本和恢复为先前版本
LabVIEW将 VI 升级到较新的版本和恢复为先前版本
428 1