#! /usr/bin/env python import subprocess import time ################ ## Hop Config ## ################ hopcfg = [1, 6, 11, 2, 7, 3, 8, 4, 9, 5, 10] #channel hopping plan chs = 0 # channel hop starting postion S = 1 # time to sleep between channel hops stop_hop = 0 #change to 1 to disable channel hopping iface_name = '%s' % ("ath0") ################ # Main # ################ hopcfg = list(hopcfg) # change hopcfg to a list while stop_hop == 0: # continues the hopping loop cn = '%s' % (hopcfg[chs]) subprocess.Popen(["iwconfig", iface_name, "channel", cn]) time.sleep(S) print chs # for debugging only print "channel", cn # for debugging only if chs >= 10: chs = 0 else: chs = chs + 1