#!/bin/csh -f # script by Mike Weller to brute-force a network, if waproamd fails # to find a broadcasted network (with "iwlist eth1 scanning") cd /etc/waproamd set maxtime=3 if ("$1" != "") set maxtime=$1 set path=(/sbin $path) set IFACE=`iwconfig |& grep 802.11|awk '{print $1}'` # check if interface is up... if (! `iwconfig $IFACE|egrep -c "Point: 00:00|Point: 44:44"`) then echo "Access point good" exit endif cd keys set filz=("`ls ess*.wep`") @ count = 0 while ($count < $#filz) @ count++ set ssid="`echo ""$filz[$count]:r""|cut -d: -f2-`" alias grab 'grep -v "#" "$filz[$count]"' set KEY=`grab|sed s/'-'/''/g` echo "trying $ssid with $KEY" echo iwconfig "$IFACE" key "$KEY" ifconfig "$IFACE" down iwconfig "$IFACE" essid "$ssid" iwconfig "$IFACE" key \[1\] iwconfig "$IFACE" key restricted iwconfig "$IFACE" key "$KEY" iwconfig "$IFACE" key on ifconfig "$IFACE" up @ timer = 0 while ($timer < $maxtime) @ timer++ if (! `iwconfig $IFACE|egrep -c "Point: 00:00|Point: 44:44"`) then echo "Access point good" goto done endif sleep 1 end end echo "no good access point found." iwconfig "$IFACE" essid any key off echo "running waproamd anyways" /usr/sbin/waproamd -i $IFACE exit done: exec ifup $IFACE