首页
社区
课程
招聘
[原创]修改adbd实现root权限运行adb命令
2022-3-29 17:46 10063

[原创]修改adbd实现root权限运行adb命令

2022-3-29 17:46
10063


在adbd中,把降权限的代码去掉,从而让adb shell永远有root的权限。去掉的代码为:

找到system/core/adb/daemon/main.cpp 修改如下代码:

static bool should_drop_privileges() {
     return false;
// #if defined(ALLOW_ADBD_ROOT)
//     // The properties that affect `adb root` and `adb unroot` are ro.secure and
//     // ro.debuggable. In this context the names don't make the expected behavior
//     // particularly obvious.
//     //
//     // ro.debuggable:
//     //   Allowed to become root, but not necessarily the default. Set to 1 on
//     //   eng and userdebug builds.
//     //
//     // ro.secure:
//     //   Drop privileges by default. Set to 1 on userdebug and user builds.
//     bool ro_secure = android::base::GetBoolProperty("ro.secure", true);
//     //netease
//     // bool ro_debuggable = __android_log_is_debuggable();
//     bool ro_debuggable=true;

//     // Drop privileges if ro.secure is set...
//     bool drop = ro_secure;

//     // ... except "adb root" lets you keep privileges in a debuggable build.
//     std::string prop = android::base::GetProperty("service.adb.root", "");
//     bool adb_root = (prop == "1");
//     bool adb_unroot = (prop == "0");
//     if (ro_debuggable && adb_root) {
//         drop = false;
//     }
//     // ... and "adb unroot" lets you explicitly drop privileges.
//     if (adb_unroot) {
//         drop = true;
//     }

//     return drop;
// #else
//     return true; // "adb root" not allowed, always drop privileges.
// #endif // ALLOW_ADBD_ROOT
}




[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
点赞2
打赏
分享
最新回复 (10)
雪    币: 110
活跃值: (189)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
无名诸葛 2022-4-12 11:04
2
0
也可以让adbd支持adb root命令,一般aosp都是支持的,也不会有root特征
雪    币: 1148
活跃值: (3354)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
王麻子本人 2022-4-12 13:52
3
0
雪    币: 1
活跃值: (2108)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
wx_范迪塞尔 2022-4-12 17:34
4
0
mark一下 
雪    币: 6067
活跃值: (2242)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
breaklink 2022-4-12 20:08
5
0
懒得重新编译,直接patch了一下指令
雪    币: 0
活跃值: (482)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
wx_沉默的逗比 2022-5-18 18:17
6
0
breaklink 懒得重新编译,直接patch了一下指令[em_13]
你哪里来的权限patch指令的?
雪    币: 0
活跃值: (482)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
wx_沉默的逗比 2022-5-18 18:18
7
0
breaklink 懒得重新编译,直接patch了一下指令[em_13]
光改root权限 rom版本是否为release版也蛮重要的,但是如果是release版,adbd是没root权限的
雪    币: 6067
活跃值: (2242)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
breaklink 2022-5-19 15:14
8
0
wx_沉默的逗比 你哪里来的权限patch指令的?
magisk
雪    币: 0
活跃值: (482)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
wx_沉默的逗比 2022-5-20 14:13
9
0
magisk特征更明显啊 你看看 分区信息,分区都变了
雪    币: 576
活跃值: (2035)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
kakasasa 2022-5-20 15:09
10
0
设备adb都不支持的时候有什么办法?0DAY?
雪    币: 0
活跃值: (482)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
wx_沉默的逗比 2022-5-23 10:23
11
0
他做这个adbd root的目的只是为了隐藏root特征,过一些app的root检测,跟如何root手机没一毛钱关系。
游客
登录 | 注册 方可回帖
返回