Home » Linux, OS Concepts and Networking » Linux Networking » Shell script for switching wifi channel using hopping

Shell script for switching wifi channel using hopping

Using the below script we tries to connect to different wifi channels of hotspot using iwconfig command.

 $ vim wifi_channel_hop.sh 
#!/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 $IEEE80211bg ;
                do
                echo "Switching to channel $CHAN"
                sudo iwconfig $IFACE channel $CHAN
                sleep 1
                done
done

Reference: https://github.com/brannondorsey/sniff-probes/blob/master/sniff-probes.sh


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment