【问题标题】:Start and terminate sniffer process from Python从 Python 启动和终止嗅探器进程
【发布时间】:2014-10-07 10:52:44
【问题描述】:

为了调试蓝牙通信,我想启动嗅探器(hcidump -Xt)并将数据转储到文件中。在终端上,我可以启动这个命令:

hcidump -Xt > myfile.txt

然后使用 Ctrl+C 终止同样的操作。

我想使用 python 脚本来实现这一点。比如:

#start sniffer 
call(["hcidump","-Xt", ">", "myfile.txt"])

#perform any activity

#Stop the sniffer - hcidump

最后,它应该停止嗅探器进程,并且所有日志都应该存储在 myfile.txt 文件中。 我尝试了一些东西,例如this one。但它没有创建预期的文件。

请告知是否有任何方法可以实现我所需要的。

【问题讨论】:

    标签: python bluetooth packet-sniffers hci


    【解决方案1】:

    您不需要使用">" 进行重定向!
    和这个差不多How do I pipe a subprocess call to a text file?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-29
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多