Wifiweasel
From Openmoko
(Difference between revisions)
Line 50: | Line 50: | ||
<br> "ESSID_NAME1" 1 -82 on | <br> "ESSID_NAME1" 1 -82 on | ||
<br> "ESSID_NAME2" 1 -49 off | <br> "ESSID_NAME2" 1 -49 off | ||
+ | |||
+ | |||
+ | |||
+ | ====precon==== | ||
+ | $iwscan_output grep off | ||
+ | |||
+ | ?compare signal? | ||
+ | |||
+ | ifconfig eth0 essid "essid" | ||
+ | udhcpc eth0 | ||
+ | chknet | ||
====chknet==== | ====chknet==== | ||
<pre> | <pre> | ||
#!/bin/sh | #!/bin/sh | ||
− | |||
− | |||
HOSTTT="google.com" | HOSTTT="google.com" | ||
for Hosts in $HOSTTT | for Hosts in $HOSTTT | ||
Line 61: | Line 70: | ||
count=$(ping -c 1 $HOSTTT | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') | count=$(ping -c 1 $HOSTTT | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') | ||
if [ $count -eq 0 ]; then | if [ $count -eq 0 ]; then | ||
− | |||
echo "FAIL" | echo "FAIL" | ||
fi | fi | ||
− | |||
if [ $count -eq 1 ]; then | if [ $count -eq 1 ]; then | ||
− | + | echo "w00t" ; | |
− | echo "w00t" | + | |
fi | fi | ||
− | |||
done | done | ||
− | |||
</pre> | </pre> | ||
outputs | outputs |
Revision as of 21:40, 21 July 2008
script to Auto connect to Open wirelss 81102 AP's
Contents |
TODO
- determine AP without encryption and sort by best signal
- using essid of best signal perform connect/udhcpc and chknet every so often
if net is down repeat
- put it all together
sandbox
iwscan
#!/usr/bin/perl # Tim Osburn - tim@osburn.com # # install perl $iwlist = "/sbin/iwlist eth0 scanning"; open scan, "$iwlist |"; while (<scan>) { if (/^\s+Cell (\S+) - Address: (\S+)/) { $CELL=$1; $ADDRESS=$2; # print "$1 $2"; $INLOOP=1; } if (/^\s+ESSID:(\S+)/) { $ESSID=$1; print " $1"; } if (/^\s+Frequency:\S+ \S+ \(Channel (\S+)\)/) { $CHAN=$1; print " $1"; } if (/^\s+Quality=\S+\s+Signal level=(\S+).*/) { $SIGNAL=$1; print " $1"; } if (/^\s+Encryption key:(\S+)/) { $ENCRYPTION=$1; print " $1\n"; } } close scan;
produces output in the form of "essid" channel signal_strength encryption_status
"ESSID_NAME1" 1 -82 on
"ESSID_NAME2" 1 -49 off
precon
$iwscan_output grep off
?compare signal?
ifconfig eth0 essid "essid" udhcpc eth0 chknet
chknet
#!/bin/sh HOSTTT="google.com" for Hosts in $HOSTTT do count=$(ping -c 1 $HOSTTT | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') if [ $count -eq 0 ]; then echo "FAIL" fi if [ $count -eq 1 ]; then echo "w00t" ; fi done
outputs
FAIL or w00t