#!/bin/sh ################################################################## # BiffSocko # wconnect (wireless connect) # # connects to wireless network with # ESSID. run wscan for getting # ESSID's # # Support Free Software: # # This program is free software; you can redistribute it # and/or modify it, but don't forget to credit the author. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ################################################################## $INTERFACE="ath0" PROG="$0" # Shameless Self Promotion echo "$PROG was written by BiffSocko 9/2006" if [ $UID -ne 0 ] then echo "you need to be root to run this program" exit 1 fi if [ $# -ne 1 -a $# -ne 2 ] then echo "usage: $PROG [ESSID]" echo "usage: $PROG [ESSID] [key] " exit 1 fi ESSID=$1 KEY=$2 echo "Status for Network Interface $INTERFACE:" ifconfig $INTERFACE| grep UP if [ $? -eq 0 ] then if [ "$KEY" != "" ] then echo "setting key $KEY" iwconfig $INTERFACE key $KEY if [ $? -ne 0 ] then echo "error setting key" exit 1 fi else echo "no WEP key to enter" fi echo "setting ESSID to $ESSID" iwconfig $INTERFACE essid $ESSID if [ $? -eq 0 ] then echo "getting IP information from $ESSID" dhclient $INTERFACE if [ $? -eq 0 ] then echo "captured IP Information from $ESSID" exit 0 else echo "Failed to capture IP Information from $ESSID" exit 1 fi else echo "iwconfig $INTERFACE essid $ESSID failed" exit 1 fi else echo "$INTERFACE interface is down" exit 1 fi