![]() |
2008-08-31
, 02:14
|
Posts: 4,556 |
Thanked: 1,624 times |
Joined on Dec 2007
|
#11
|
![]() |
2008-08-31
, 02:45
|
Posts: 30 |
Thanked: 7 times |
Joined on Nov 2007
|
#12
|
![]() |
2008-08-31
, 04:48
|
Posts: 14 |
Thanked: 2 times |
Joined on Aug 2008
|
#13
|
![]() |
2008-09-01
, 02:30
|
Posts: 121 |
Thanked: 28 times |
Joined on Oct 2007
|
#14
|
![]() |
2008-09-02
, 20:51
|
Posts: 15 |
Thanked: 1 time |
Joined on Sep 2008
|
#15
|
#!/bin/bash # Finds the strongest unencrypted AP and tries to connect to it via dhcp # Call this script like "wifi.sh wlan0" echo hi if [ `whoami` != "root" ];then echo "Sorry, you need to be root to run this program" exit 1 fi interface=wlan0 ifconfig $interface up # Proggy while true do iwlist $interface scan > $TEMP NumAPs=`cat $TEMP | grep ESSID | wc -l` BestAP=0 BestQuality=-1 BestESSID="" echo APs: $NumAPs for i in `seq 1 $NumAPs`; do # Check if AP is encrypted Encryption=`cat $TEMP | grep Encryption | head -n$i | tail -n1 | cut -d":" -f2` if [ $Encryption = "off" ]; then # Find AP with the highest quality ESSID=`cat $TEMP | grep ESSID | head -n$i | tail -n1 | cut -d"\"" -f2` MODE=`cat $TEMP | grep Mode | head -n$BestAP | tail -n1 | cut -d":" -f2` QUALITY=`cat $TEMP | grep Quality | head -n$i | tail -n1 | cut -d":" -f2 | cut -d"/" -f1 | sed 's/ //g'` echo ESSID=$ESSID Mode=$MODE Quality=$QUALITY if [ "$QUALITY" -gt "$BestQuality" ]; then BestQuality=$QUALITY BestAP=$i BestESSID=$ESSID fi fi done if [ $BestAP -gt 0 ]; then timeout 2 mplayer /usr/share/sounds/ui-new_email.wav > /dev/null 2>&1 & # Yay, we found an unencrypted AP: echo #ESSID=`cat $TEMP | grep ESSID | head -n$BestAP | tail -n1 | cut -d"\"" -f2` CHANNEL=`cat $TEMP | grep Channel | head -n$BestAP | tail -n1 | cut -d":" -f2 | sed 's/Channel //g' | sed 's/)//g'` echo Connecting to \"$BestESSID\" Channel $CHANNEL echo # Connect iwconfig $interface essid "$BestESSID" channel $CHANNEL mode managed #$MODE sleep 3 iwconfig #2>&1 | grep ESSID echo if ping -c2 `udhcpc -i $interface -n -q 2>&1 | grep dns | cut -d" " -f3` then echo ping -c 1 www.google.com echo echo very well echo read a ifconfig $interface down ifconfig $interface up else echo echo bad echo ifconfig $interface down ifconfig $interface up fi fi done # Cleanup
![]() |
2008-09-03
, 05:00
|
Posts: 15 |
Thanked: 1 time |
Joined on Sep 2008
|
#16
|