0

I am trying to write a script that runs airodump-ng. I use the command:

timeout -sHUP 1m airodump-ng -d MYBSSID -w wpahandshake wlan0mon

when I run it from the command line it works but when i run it from a script it creates a empty .cap file. Do someone have an explanation to why and a solution?

1

This is a bug existing in airodump-ng 1.2 rc4 (Released 14 Feb 2016) to airodump-ng 1.2 (Released 15 Apr 2018).

But in 18 Apr 2018, the GitHub user Mister-X fixed the problem. See the commit.

In src/airodump-ng.c with the bug, it will use input_thread() to create a thread regardless of whether the airodump-ng process running in the foreground or background.

The input_thread() will call mygetch(). And the mygetch() will call getchar(). Thus airodump-ng process will read stdin when running in the background.

In Linux, if a process reads stdin when running in the background, it will be stopped. And running timeout without --foreground option will let the COMMAND, here is airodump-ng, run in the background. So in this situation, the airodump-ng will be stopped and create a empty .cap file (asked by you).

There are two lines of thinking to solve your problem:

  1. Let the airodump-ng run in the foreground by using --foreground option of timeout or running source <your_orignal_script.sh>.

  2. Don't let the airodump-ng read stdin when running in background by redirecting stdin to /dev/null, timeout -sHUP 1m airodump-ng -d MYBSSID -w wpahandshake wlan0mon < /dev/null or downloading the newest source code without the bug from GitHub then compile and install it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.