diff options
author | lassulus <lassulus@googlemail.com> | 2013-05-23 20:31:24 +0200 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-05-23 20:31:24 +0200 |
commit | 107991ba0d1a6710389902abbe41eb42c7af05bf (patch) | |
tree | 1de910f8fc2e83ff23bd11d7e354f29a45583c88 /usr/bin | |
parent | ef5a4dc7b3ca4bfae0f9b470458017a2087f5e90 (diff) |
now with epic scanning
Diffstat (limited to 'usr/bin')
-rwxr-xr-x | usr/bin/autowifi | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi index 8815fb75..bbd6258f 100755 --- a/usr/bin/autowifi +++ b/usr/bin/autowifi @@ -20,4 +20,38 @@ connect_wifi(){ wifi up } +iwlist_scan(){ + count=0 + + iwlist scan ${1:-} 2>/dev/null | ( while read line; + do + case "$line" in + *"Cell "*) + #echo + : $((count+=1)) + echo MAC_${count}="${line#*Address: }" + ;; + *Channel:*) + echo CHANNEL_${count}="${line#*:}" + ;; + *Quality=*) + echo QUALITY_${count}="`printf '%s' ${line#*Quality=} | cut -d/ -f 1`" + ;; + *"Encryption key:"*) + echo ENCRYPTION_${count}="${line#*key:}" + ;; + *ESSID:*) + echo ESSID_${count}="${line#*ESSID:}" + ;; + *"IE: IEEE 802.11i/WPA2"*) + echo WPA2_${count}=1 + ;; + *"IE: WPA Version 1"*) + echo WPA_${count}=1 + ;; + *);; + esac + done; echo WIFI_COUNT=$count) +} +iwlist_scan > /tmp/${wifi}.scan connect_wifi "$@" |