7 # Base key used to compute the actual key
8 KEY_BASE="My WEP is better than yours"
9 # Security mode (open/restricted)
11 # Comment this if you don't want to rotate the channel
13 # Channels supported by the wireless interface
15 # Uncomment if you want the script to work only if you're on a specific essid
17 # Uncomment if your wireless interface need the commit command
22 # The format has to be in date(1) format, and probably has to have a relation
23 # with the frequency the script is executed. The default value is useful for a
24 # 1/2 day frequency (rotation every 12 hs). date(1) is executed with C locale so
26 # A good crontab line for this is:
27 # 0 0,12 * * * /path/to/script
28 KEY_FORMAT="$KEY_BASE%D%p"
29 # Key size, 1-5 for 64bit encryption, 6-13 for 128bit encryption
31 # Hash command/algorithm used to compute the actual key
36 # Unless you know what you're doing, and in that case, send me the patch ;)
40 # Check if they are using our essid
43 curr_essid=`iwconfig $IFACE | grep ESSID | sed 's/.*ESSID:"\([^"]\+\)".*/\1/'`
44 if [ "$curr_essid" != "$ESSID" ]
51 str=`date +"$KEY_FORMAT"`
52 size=$(($KEY_SIZE * 2))
53 key=`echo "$str" | $HASH_PROG | cut -c-$size`
55 # Compute the new channel
56 if [ -n "$ROTATE_CHANNEL" ]
58 chan=`echo $key | tr abcdef 847502 | cut -c-6`
59 chan=$(($chan % $MAX_CHANNEL + 1))
60 channel="channel $chan"
64 /sbin/iwconfig $IFACE key $SECURITY_MODE $key $channel $COMMIT
66 # vim: set et sw=2 sts=2 :