summaryrefslogtreecommitdiffstats
path: root/usr/bin/iwlist_env
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2014-12-20 22:02:08 +0100
committermakefu <github@syntax-fehler.de>2014-12-20 22:02:08 +0100
commit16e1373ddd9050dd06cd699b2874cf178375574b (patch)
tree0352a0f39f4426327ffd4aa16dad8e0e15a6a8c4 /usr/bin/iwlist_env
parent120114ad12a212331e9e790305a4ab3afdc15857 (diff)
parent6a9beb12dad44b5e1efa984b112c7a6b8c13a118 (diff)
Merge remote-tracking branch 'inspector_wifi/wifi_scanner'
Conflicts: .gitignore
Diffstat (limited to 'usr/bin/iwlist_env')
-rwxr-xr-xusr/bin/iwlist_env33
1 files changed, 33 insertions, 0 deletions
diff --git a/usr/bin/iwlist_env b/usr/bin/iwlist_env
new file mode 100755
index 00000000..29112ff3
--- /dev/null
+++ b/usr/bin/iwlist_env
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+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)