zoukankan      html  css  js  c++  java
  • Android 获取root权限 实现重启

    怎么获取root权限,这是个问题。网上说用mk+uid能获得,早之前我只会用cmd去获取,而且还要安装一个superuser前提还要是已经破解过的

    代码如下:(求大神赐教mk的方法)

    Process process = null;
                            DataOutputStream os 
    = null;
                            
    try {
                                process 
    = Runtime.getRuntime().exec("su");
                                os 
    = new DataOutputStream(process.getOutputStream());
                                os.writeBytes(
    " exit \n");
                                os.writeBytes(
    " exit \n");
                                os.flush();
                                process.waitFor();
                            } 
    catch (Exception e) {
                            } 
    finally {
                                
    try {
                                    
    if (os != null) {
                                        os.close();
                                    }
                                    process.destroy();
                                } 
    catch (Exception e) {
                                }
                            }//先获取应用root
     
    Process process = null;
        DataOutputStream os = null;
        try {
         process = Runtime.getRuntime().exec("su");
         os = new DataOutputStream(process.getOutputStream());
         os.writeBytes(" reboot -p \n");//重启代码= = 我在cmd里面su了之后还是不能关机,只能重启。哎。
         os.flush();
         process.waitFor();
        } catch (Exception e) {
        } finally {
         try {
          if (os != null) {
           os.close();
          }
          process.destroy();
         } catch (Exception e) {
         }
        }

    求大神赐教真正获取root权限。

  • 相关阅读:
    [Android-NDK编译] ndk 编译 c++ 兼容性问题汇总整理
    [云计算] 001.云计算简介
    eatwhatApp开发实战(十一)
    eatwhatApp开发实战(十)
    [Unity2d系列教程] 002.引用外部DLL
    Istio Sidecar
    Kubernetes Dashborad 搭建
    Istio 1.6架构及性能
    kubeadm 搭建kubernetes集群环境
    docker 安装
  • 原文地址:https://www.cnblogs.com/stay/p/2140746.html
Copyright © 2011-2022 走看看