autojs 判断root

function isRoot() {
    var file = null;
    var paths = ["/system/bin/", "/system/xbin/", "/system/sbin/", "/sbin/", "/vendor/bin/", "/su/bin/"];
    try {
        for (let path in paths) {
            let file = new java.io.File(paths[path] + "su");
            if (file.exists() && file.canExecute()) return true;
        }
    } catch (x) {
        toast("错误" + x)
    }
    return false;
}
点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注