Android 刷机,获取root

一、概述:

1、iphone越狱,android root都是根据系统漏洞才能获取
2、其实是根据 su 获得系统的手机的超级权限

二、步骤:

1、进入E:\android-sdk\platforms\android-10\images,找到system.img镜像文件
2、打开yaffs2img浏览器.exe
3、选取镜像文件
这里写图片描述
4、把su文件拷贝到bin目录下
这里写图片描述
这里写图片描述
5、修改权限0755为4755,其他用户拥有root权限
这里写图片描述
6、使用superuser.apk,导入到app文件夹(superuser.apk获取root的最后防线)
这里写图片描述
修改权限0755为4755
7、整理导出
这里写图片描述
这里写图片描述

8、拷贝到原来的目录下E:\android-sdk\platforms\android-10\images,覆盖原来的system.img文件
这里写图片描述
9、以 arm 方式 重启2.3模拟器
10、打开superuser.apk
这里写图片描述

11、进入cmd窗口,输入

>adb -s emulator-5554 shell
>su 

12、创建页面

//变成超级用户,获得root权限
Runtime.getRuntime().exec(“su”);

/**
 * @描述         获取root
 * @项目名称      App_imooc
 * @包名         com.android.imooc.async
 * @类名         RootActivity
 * @author      chenlin
 * @date        2012年6月11日 上午10:26:12
 * @version     1.0
 */

public class RootActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_root);
    }

    public void getRoot(View view){
        try {
            //变成超级用户
            Runtime.getRuntime().exec("su");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="getRoot"
        android:text="获取root" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="disable"
        android:text="冻结程序" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="enable"
        android:text="解冻程序" />

</LinearLayout>

13、冻结程序,解冻程序

拷贝roottools.jar到项目的libs目录
在主页写入下面代码:

public void enable(View view){
        try {
            RootTools.sendShell("pm enable com.android.game", 3000);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void disable(View view){
        try {
            RootTools.sendShell("pm disable com.android.game", 3000);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

14、工具类下载:
链接:http://pan.baidu.com/s/1i5lmb33 密码:s40n

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lovoo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值