与Python在Raspberry Pi上进行ARP扫描
我试图通过Python脚本在Raspberry Pi上运行ARP扫描。
我已经使用了子过程库尝试了以下代码,但是当我尝试打印输出时,我收到的错误是没有
p = subprocess.Popen(" sudo arp-scan -l", stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
status = p.wait()
print(output)
print(err)
人能够告诉我我在做什么错?
非常感谢
I am trying to run an ARP-scan on my raspberry Pi from a Python script.
I have tried the following code using the subprocess library, however when I attempt to print output I receive the error that there is no such variable
p = subprocess.Popen(" sudo arp-scan -l", stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
status = p.wait()
print(output)
print(err)
Is anyone able to tell me what I am doing wrong?
Many thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这样尝试:
Try like this:
我有点愚蠢。我在PI上的Python终端上测试了这些命令,它不会打印输出。但是,当我将其保存为脚本并执行它时,它会尽可能地工作。
感谢您的帮助
I have been a bit stupid. I was testing these commands on a Python terminal on my pi and it would not print output. However when I save this as a script and execute it, it works as it should.
Thanks for the help