简体   繁体   English

如何捕获发送到Android设备的ADB命令

[英]How to catch adb commands that send to android devices

I am running a auto test tool on my PC with android devices connected; 我在连接了android设备的PC上运行自动测试工具; I found that during the test, the tool send some adb commands to the device; 我发现在测试过程中,该工具向设备发送了一些adb命令; I want to know what the adb commands exactly is? 我想知道adb命令到底是什么? How to catch the commands on PC or on the android device? 如何在PC或android设备上捕获命令?

I want to get a result like:"adb install xxx.apk" 我想得到这样的结果:“ adb install xxx.apk”

You can trick the pc - script something in your favourite language and compile it to adb.exe. 您可以欺骗计算机-用您喜欢的语言编写脚本并将其编译为adb.exe。

The script would just tee the command into some file, and later you can read it. 该脚本会将命令发送到某个文件中,稍后您可以阅读它。 In order to do that, just rename adb.exe to something else, and when placing your fake adb.exe, just tee the command to some file and still call the adboldfile.exe. 为此,只需将adb.exe重命名为其他名称,然后在放置伪造的adb.exe时,只需将命令发送到某个文件,然后仍然调用adboldfile.exe。

It´s ugly and hacky but it will do the trick. 这很丑陋,但是可以解决问题。 Don´t know if there is a good way to achieve it. 不知道是否有实现它的好方法。

If you are into recompiling adbd, you can also see this question and it´s response, it adds adbd commands to history: 如果您要重新编译adbd,还可以看到此问题及其响应,它将adbd命令添加到历史记录中:

ADB command history ADB命令历史

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM