
Originally Posted by
Virchanza
Anybody been playing around with this some more? I still can't see why Aircrack won't work when you specify "/dev/stdin".
I can't find my reference book on this topic (it's no doubt buried somewhere beneath a tonne of other books), but /dev/stdin is treated as a file when you try to open it, rather than as an input device - and it doesn't operate the same way as most other /dev/ nodes do.
For example:
Code:
# echo password | aircrack-ng -w /dev/stdin -e devnetwork dev-01.cap
Empty dictionnary
Empty dictionnary
Opening dev-01.cap
Read 415 packets.
Opening dev-01.cap
Please specify a dictionary (option -w).
Quitting aircrack-ng...
And if I tried to write to the device node to begin with:
Code:
# echo password > /dev/stdin ; aircrack-ng -w /dev/stdin -e devnetwork dev-01.cap
password
Empty dictionnary
Empty dictionnary
Opening dev-01.cap
Read 415 packets.
Opening dev-01.cap
Please specify a dictionary (option -w).
Quitting aircrack-ng...
Note the highlight. Now, if we start using the built in "-w -" which is probably setting the file descriptor to be 0 (stdin IIRC, and not a "filename" - rather a special case in the assembly code):
Code:
echo password > /dev/stdin ; aircrack-ng -w - -e devnetwork dev-01.cap
The screen appears to "hang" because aircrack is waiting to get something from stdin - to do a "read(0, buffer, size_to_read);" call (as opposed to an fread), probably having just called fflush(stdin) to be sure it's not picking up rubbish as it goes.
So that's a little convoluted but the premise is the same: when you write "/dev/stdin" most programs (if not all) are going to treat it as an actual file rather than a device node. When the file is empty, the program closes. Without looking at the actual code, I would guess that aircrack is either checking this, or is noting an empty filesize.
BUT
Isn't there always a but.
cat is a special case - or perhaps not special, it's just coded differently yes - cat blocks on the device. A better illustration is to use tail:Which will just sit there and wait sort of like a network socket.
Someone would have to explain the technical reasons behind all that. It's pretty early for me at the moment, but there it is.