summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-05-24 17:01:34 +0200
committermakefu <github@syntax-fehler.de>2013-05-24 17:01:34 +0200
commitd1f669625da04a520133f3977124b5151ed30eaa (patch)
treebc489c272a36dd181929199bd5a236057cdb9032 /usr
parente28ab86654d9f70ea055929ae37d040783d4af9a (diff)
now using print env instead of direct echoing
Diffstat (limited to 'usr')
-rwxr-xr-xusr/bin/autowifi52
1 files changed, 35 insertions, 17 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi
index 3fe9229b..bee49844 100755
--- a/usr/bin/autowifi
+++ b/usr/bin/autowifi
@@ -20,6 +20,21 @@ connect_wifi(){
wifi up
}
+print_iwlist_env(){
+ # takes environment:
+ # count
+ # MAC
+ # CHANNEL
+ # QUALITY
+ # ENCRYPTION
+ # ESSID
+ # WPA
+ # WPA2
+ for i in ESSID MAC CHANNEL QUALITY ENCRYPTION WPA WPA2;do
+ eval echo ${i}_${count}=\$${i}
+ done
+}
+
iwlist_scan(){
ifconfig $wifi up
@@ -29,31 +44,33 @@ iwlist_scan(){
do
case "$line" in
*"Cell "*)
- #echo
+ [ $count -eq 0 ] || print_iwlist_env
+ WPA=0
+ WPA2=0
: $((count+=1))
- echo MAC_${count}="${line#*Address: }"
+ MAC="${line#*Address: }"
;;
*Channel:*)
- echo CHANNEL_${count}="${line#*:}"
+ CHANNEL="${line#*:}"
;;
*Quality=*)
- echo QUALITY_${count}="`printf '%s' ${line#*Quality=} | cut -d/ -f 1`"
+ QUALITY="`printf '%s' ${line#*Quality=} | cut -d/ -f 1`"
;;
*"Encryption key:"*)
- echo ENCRYPTION_${count}="${line#*key:}"
+ ENCRYPTION="${line#*key:}"
;;
*ESSID:*)
- echo ESSID_${count}="${line#*ESSID:}"
+ ESSID="${line#*ESSID:}"
;;
*"IE: IEEE 802.11i/WPA2"*)
- echo WPA2_${count}=1
+ WPA2=1
;;
*"IE: WPA Version 1"*)
- echo WPA_${count}=1
+ WPA=1
;;
*);;
esac
- done; echo WIFI_COUNT=$count)
+ done; print_iwlist_env ;echo WIFI_COUNT=$count)
}
crack_wifi(){
if [ -n "$6" ];then
@@ -94,12 +111,13 @@ loop_over_networks(){
done
}
-iwlist_scan > /tmp/${wifi}.scan
-loop_over_networks
+#iwlist_scan > /tmp/${wifi}.scan
+#loop_over_networks
-while sleep 60; do
- if ! check_internet; then
- iwlist_scan > /tmp/${wifi}.scan
- loop_over_networks
- fi
-done
+#while sleep 60; do
+# if ! check_internet; then
+# iwlist_scan > /tmp/${wifi}.scan
+# loop_over_networks
+# fi
+#done
+iwlist_scan