gpt4 book ai didi

真实设备中的 Android strace

转载 作者:太空狗 更新时间:2023-10-29 12:21:36 28 4
gpt4 key购买 nike

我有以下情况,我想监控Android手机上的系统调用所以我做了一个脚本来做到这一点。使用 Android Emulator 可以完美运行(在我的 Ubuntu 上的特定文件中写入应用程序的踪迹)。问题是当我附加一个真实的手机来分析它时,它在结果文件中说以下内容:

ptrace attach failed: Operation not permitted

我正在使用这段代码来获取它,但我不明白为什么它可以在模拟器上运行,而不是在获得 root 权限的真实设备上运行。

这是我在 perl 中使用的命令:

system("$dirTools/adb -s $Device shell strace -p $PID[1]>$dirRecordDataSet/$Date/$appName &");

有什么建议吗?提前致谢

最佳答案

可能是 adb 守护进程以有限权限运行。您可以尝试使用 setuid roo 安装 strace。这是有关它的联机帮助页建议:

Setuid Installation

If strace is installed setuid to root then the invoking user will be able to attach to and trace processes owned by any user. In addition setuid and setgid programs will be executed and traced with the correct effective privileges. Since only users trusted with full root privileges should be allowed to do these things, it only makes sense to install strace as setuid to root when the users who can execute it are restricted to those users who have this trust. For example, it makes sense to install a special version of strace with mode 'rwsr-xr--', user root and group trace, where members of the trace group are trusted users. If you do use this feature, please remember to install a non-setuid version of strace for ordinary lusers to use.

关于真实设备中的 Android strace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5144967/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com