This is required before libtins/libpcap will get packets:
DEVICE=wlan0
sudo ifconfig $DEVICE down
sudo iwconfig $DEVICE mode monitor
sudo ifconfig $DEVICE up
Once done, don't forget the reverse:
DEVICE=wlan0
sudo ifconfig $DEVICE down
sudo iwconfig $DEVICE mode auto
sudo ifconfig $DEVICE up
Probably easier to do this in bash than trying to implement in C++.
Example script below. Might need updating for 802.11n + ac.
#!/bin/bash
IFACE=wlan0
IEEE80211bg="1 2 3 4 5 6 7 8 9 10 11"
IEEE80211bg_intl="$IEEE80211b 12 13 14"
IEEE80211a="36 40 44 48 52 56 60 64 149 153 157 161"
IEEE80211bga="$IEEE80211bg $IEEE80211a"
IEEE80211bga_intl="$IEEE80211bg_intl $IEEE80211a"
while true ; do
for CHAN in $IEEE80211bga_intl ; do
echo "Switching to channel $CHAN"
iwconfig $IFACE channel $CHAN
# Sleep for 0.1 seconds (similar to kismet)
sleep 0.1
done
done
We need a card that supports this, the mini ones do not.
DEVICE=wlan0
# txpower is in dBm
sudo iwconfig $DEVICE txpower 5
Is there any libraries or modules to support native C++ channel hopping, I wasn't really able to find anything solidly. Any guidance would be appreciated.