从airodump中-NG阅读实时输出 [英] Reading realtime output from airodump-ng
问题描述
当我执行命令airodump中 - ng的MON0 >> output.txt的,output.txt的是空的。我需要能够运行airodump中-纳克MON0和大约5秒后停止命令,比能够获得它的输出。任何想法,我应该开始看?我使用bash。
When I execute the command airodump-ng mon0 >> output.txt , output.txt is empty. I need to be able to run airodump-ng mon0 and after about 5 seconds stop the command , than have access to its output. Any thoughts where I should begin to look? I was using bash.
推荐答案
作为后台进程启动命令,睡眠5秒,然后杀死后台进程。您可能需要重定向比STDOUT不同的流对于在文件中捕获的输出。 这个线程提到STDERR(这将是FD 2)。我不能在这里验证这一点,但你可以检查与 strace的
描述符数量。该命令应显示是这样的:
Start the command as a background process, sleep 5 seconds, then kill the background process. You may need to redirect a different stream than STDOUT for capturing the output in a file. This thread mentions STDERR (which would be FD 2). I can't verify this here, but you can check the descriptor number with strace
. The command should show something like this:
$ strace airodump-ng mon0 2>&1 | grep ^write
...
write(2, "...
在数写
语句是文件描述符 airodump中-NG
写入
The number in the write
statement is the file descriptor airodump-ng
writes to.
脚本可能看起来有点像这样(假设STDERR需要重定向):
The script might look somewhat like this (assuming that STDERR needs to be redirected):
#!/bin/bash
{ airodump-ng mon0 2>> output.txt; } &
PID=$!
sleep 5
kill -TERM $PID
cat output.txt
这篇关于从airodump中-NG阅读实时输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!