Skip to content Skip to sidebar Skip to footer

Subprocess Grab Stdout Of Airodump-ng

I am trying to grab the stdout from airodump-ng using subprocess with no luck. I think my code causes a deadlock. airodump = subprocess.Popen(['airodump-ng','mon0'],stdin=subpro

Solution 1:

Don't sleep and wait (that will just cause airodump to block on a full pipe buffer) and don't use an unbounded read(). The communicate() method does what you need:

o_airodump, unused_stderr = airodump.communicate(timeout=15)
airodump.kill()

Note: The timeout parameter on communicate was introduced in Python 3.3 which isn't quite out yet. ;)


Solution 2:

airodump.communicate() 

waits for the process to terminate then returns (stdout, stderr)

IF you really pushed you could always link directly to the c library using ctypes. Enjoy hacking.


Post a Comment for "Subprocess Grab Stdout Of Airodump-ng"