#! /bin/bash # Variables for settings. DEV=eth1 #I'm using eth1, but change this to whatever your wifi card is. SSID=any #Replace this with your AP's SSID or leave as any for any AP. CHANNEL=6 #Set the channel of your AP. # The Aironet supports multiple (up to 5) keys. So set them here, if you have more than one. # This can be used for a home/work set up. WepKeys[0]="hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh" WepKeys[1]="hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh" WepKeys[2]="hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh" WepKeys[3]="hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh" WepKeys[4]="hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh:hh" WepKeyToUse=0 #And select which key to use here. AironetWepKey=($WepKeyToUse+1) #Don't change this line. # Stop the network adapter, disconnect from any networks, etc. ifconfig $DEV down # Set the SSID iwconfig $DEV essid $SSID channel $CHANNEL # Set the WEP key echo "$WepKeyToUse ${WepKeys[$WepKeyToUse]}" > /proc/driver/aironet/$DEV/WepKey # Set Restricted mode and make the first (numbered 0) active iwconfig $DEV key restricted [$AironetWepKey] # If you need to undo the WEP set up, uncomment the following line. # iwconfig $DEV key off channel $CHANNEL # And activate the changes ifconfig $DEV up # Ideally, you're now connected. pump -i $DEV #Ask for an IP address from the AP's DHCP. # I use this to let me know when the script is done, and it gives me the config of the device. # Uncomment this if you use KDE and what to see this. # kdialog --title $DEV --passivepopup "`ifconfig $DEV`" 10 &