android app 获得root 权限管理,获得Android App的“root”权限

首先:请注意,您只能使用su执行shell命令(=您只能以root身份使用shell命令,而不能使用java代码).

第二:不确定这是否适用于所有su应用程序,但这是我手机上su的帮助信息:

Usage: su [options] [–] [-] [LOGIN] [–] [args…]

Options:

–daemon start the su daemon agent

-c, –command COMMAND pass COMMAND to the invoked shell

-h, –help display this help message and exit

-, -l, –login pretend the shell to be a login shell

-m, -p,

–preserve-environment do not change environment variables

-s, –shell SHELL use SHELL instead of the default /system/bin/sh

-u display the multiuser mode and exit

-v, –version display version number and exit

-V display version code and exit,

this is used almost exclusively by Superuser.apk

这意味着:你必须运行su -c something(或su -c something – root,但root仍然是默认值).实际上,这在大多数Linux系统上等于su,除了守护进程之外,因为在常规Linux系统上没有守护进程.

如果其他su命令行为不同(这是可能的),打开流到shell,执行su,评估它的返回代码,然后继续执行其他命令,最后执行exit更安全.

    原文作者:邵浩博士
    原文地址: https://blog.csdn.net/weixin_35949435/article/details/117292324
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞