I'm searching for a equivalent of "iwconfig eth0 mode Monitor" in Mac OS.
From man iwconfig mode Monitor does the following:
"the node is not associated with any cell and passively monitor all packets on the frequency"
What you're looking for is /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport. It's a binary command, which I've symlinked into /usr/local/bin/ for convenience.
Creating Symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport Example of sniffing in monitor mode:
sudo airport en1 sniff 1 This sniffs on channel 1 and saves a pcap capture file to /tmp/airportSniffXXXXXX.pcap (where XXXXXX will vary). You can view this with tcpdump -r <filename> or by opening it in wireshark.
To search for active channels nearby that you can sniff, run this:
sudo airport en1 -s Although you can capture any traffic, you can only effectively read if the network is open or you have the encryption key.
.cap and not .pcap as described. (OS X Mavericks 10.9) You can also do it via the GUI if that is easier for you.
In Mavericks:
Pass the -I flag to tcpdump or tshark (wireshark command-line utility).
For example, to save everything from radiotap headers down to the application layer packets to a file named 'save.pcap':
tcpdump -Ini en0 -w save.pcap Or to examine probe request 802.11 management frames live:
tshark -Ini en0 -s 256 type mgt subtype probe-req Note, one OS X you will have to run the commands as root or grant yourself permission to access the kernel's packet filters:
sudo chmod 0644 /dev/bpf* by default on OSX en0 is your ethernet port, while en1 is your airport
try:
iwconfig en1 mode monitor