Android 的复制保护如何检查设备是否已 root?

发布于 2024-12-09 00:38:39 字数 693 浏览 0 评论 0原文

http://developer.android.com/guide/publishing/licensing.html,在“复制保护的替换”部分下,它说:

Android Market 上旧版复制保护机制的限制 使用它的应用程序只能安装在兼容的计算机上 提供安全内部存储环境的设备。为了 例如,无法从市场下载受版权保护的应用程序 到提供 root 访问权限的设备,并且应用程序无法 安装到设备的 SD 卡。

Android 的(同时已弃用)复制保护如何检查设备是否已 root?据 Dianne Hackborn 说,据我所知,这是不可能的(参见 如何检测设备是否已在应用程序中获得 root 权限?)。所以这只能意味着,检查是通过一些(公众未知的)混淆标准检查来完成的,我想显然不仅仅是简单检查“su”命令是否存在。 有人知道更多关于检查逻辑的信息吗?或者它的安全性如何?

On http://developer.android.com/guide/publishing/licensing.html, under section "Replacement for Copy Protection" it says:

A limitation of the legacy Copy Protection mechanism on Android Market
is that applications using it can be installed only on compatible
devices that provide a secure internal storage environment. For
example, a copy-protected application cannot be downloaded from Market
to a device that provides root access, and the application cannot be
installed to a device's SD card.

How can Android's - meanwhile deprecated - Copy Protection check whether the device is rooted? Afaik it's not possible, also according to Dianne Hackborn (see How can you detect if the device is rooted in the app?). So that can only mean, the check is done by some (unknown the the public) obfuscated criteria check, obviously not just a simple check whether the 'su' command exists, I suppose.
Does anybody know more about that check logic - or how secure that is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情未る 2024-12-16 00:38:39

这就是我使用的:

public static boolean isDeviceRooted () {
    boolean ret = false;
    String path = null;
    Map<String,String> env = System.getenv();

    if (env != null && (path = env.get("PATH")) != null) {
        setDevicePath(path);
        String [] dirs = path.split(":");
        for (String dir : dirs){
            String suPath = dir + "/" + "su";
            File suFile = new File(suPath);
            if (suFile != null && suFile.exists()) {
                setSuLocation(suPath);
                ret = true;
            }
        }
    }
    return ret;
}

理论上,它不会在所有情况下工作,因为用户可以将“su”放置到非标准位置,该位置不在路径中,但实际上如果他这样做,其他需要的应用程序知道“su”在哪里也找不到它,所以root的目的就落空了。

This is what I use:

public static boolean isDeviceRooted () {
    boolean ret = false;
    String path = null;
    Map<String,String> env = System.getenv();

    if (env != null && (path = env.get("PATH")) != null) {
        setDevicePath(path);
        String [] dirs = path.split(":");
        for (String dir : dirs){
            String suPath = dir + "/" + "su";
            File suFile = new File(suPath);
            if (suFile != null && suFile.exists()) {
                setSuLocation(suPath);
                ret = true;
            }
        }
    }
    return ret;
}

Theoretically, it's not going to work in all cases, because a user can put 'su' to a non-standard location, which is not in a PATH, but practically if he does that, other applications that need to know where 'su' is won't find it either, so the purpose of rooting will be defeated.

吾家有女初长成 2024-12-16 00:38:39

虽然超级用户应用程序的存在并不是判断手机是否已root的完美方式,但它是一个很好的指示。为什么不直接检查 com.noshufou.android.su 包是否已安装?

我从未尝试过,但我不明白为什么它不起作用。

While the presence of the Superuser app isn't a perfect way to tell if the phone is rooted its a pretty indicator that it might be. Why not just check to see if the package com.noshufou.android.su is installed?

I've never tried it but I don't see why it wouldn't work.

夏末的微笑 2024-12-16 00:38:39

我们会在销售信息中明确说明该应用程序不能在已取得 root 权限的设备上运行。

这肯定会影响您的安装率。尽管您计划以 1000 美元的价格出售您的应用程序,但这将产生比您可以采取的任何其他措施更糟糕的效果。

We would clearly state in the sales information that the app doesn't run on rooted devices.

This will definitely affect your install rate. Although you are planning to sell your app for $1000, that is going to have a much worse effect than anything else you could to it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文