android adb shell su设置密码
1.打开su源码在system/extras/su/su.c的main函数开头增加密码判断,代码如下
char *rootPasswd = "xxxxxxxxxxx"; char enterPasswd [50] = {0}; fprintf(stdout,"Enter su password:\n"); while (1) { char * ret = fgets(enterPasswd, sizeof(enterPasswd), stdin); if (ret != NULL && strncmp(ret, rootPasswd, strlen(rootPasswd) == 0) break; } else { fprintf(stdout, "Password is error,try again:\n"); } }
2.这样就在每次输入su时提示输入密码。验证:编译模块,将编译好的su放到板子中,改权限 chmod 06755,然后运行试试。如果成功,再把编译好的su替换源码中的su,然后重新编译系统。注意的地方:修改了su.c后编译系统并不会将su执行文件放在/system/xbin,我的源码是需要替换这两个文件:这需要看自己系统的编译makefile确定。
device/rockchip/rk3288/xsu b/device/rockchip/rk3288/xsu和 device/rockchip/rk3288/su b/device/rockchip/rk3288/su
3.屏蔽掉adb root:在文件/system/core/adb/services.cpp中注释掉
ret = create_service_thread(restart_root_service, NULL);
相关推荐
huha 2020-10-16
magic00 2020-08-03
yangChong 2020-07-29
adb shell cd system/app rm *.apk21. 获取管理员权限: adb root22. 启动Activity: adb shell am start -n 包名/包名+类名。
蓝天梦 2020-07-28
xiaobater 2020-07-27
applecarelte 2020-07-05
xiaobater 2020-07-04
QCkiss 2020-06-21
lucialee 2020-06-13
freerocker 2020-05-25
走向未来 2020-05-09
liushun 2020-04-24
Jieen 2020-04-22
doomvsjing 2020-04-16
momomumu 2020-04-08