I wrote a perl script that should automate attack processes (similar to airoscript.sh, but adjusted to my purposes). This script starts aireplay-ng and airodump-ng as child processes and captures their output to analyze it. I'm using a perl idiom like this:
The problem about this is that it's blocking because airodump-ng (and aireplay-ng) are obviously buffering outputs, and I'm unable to turn this behaviour off from outside the binaries.
my $capturer = open(CAPTURE,Log("airodump-ng -c $channel --update 5 --bssid $MACAP -w output $if_capture 2>&1 |"))
or die "Cannot start capturer: $!\n";
my $captureFH = fileno(CAPTURE);
vec($rin, $captureFH, 1)=1;
select($rout=$rin, undef, undef, undef);
if (vec($rout, $captureFH, 1))
$line = <CAPTURE>;
So I modified aireplay.c and airodump.c directly and added a simple "setbuf(stdout,0);" as first statement in main(). Additionally I changed all "\r" of airodump-ng to "\n" and stored the new binaries as "airodump-unbuff" and "aireplay-unbuff". Now it's working perfectly.
Of course I'd prefer not having to do this manually for every new release, so it would be great if such a "batch"/"non-interactive"/unbuffered mode could directly be integrated into the executables as a simple option. Or is there some other way to go around this problem?