Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading realtime output from airodump-ng

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.

like image 901
EK_AllDay Avatar asked Jul 21 '13 20:07

EK_AllDay


1 Answers

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, "...

The number in the write statement is the file descriptor airodump-ng writes to.

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
like image 74
Ansgar Wiechers Avatar answered Oct 21 '22 11:10

Ansgar Wiechers