summaryrefslogtreecommitdiffstats
path: root/usr/bin
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-05-23 19:09:59 +0200
committermakefu <github@syntax-fehler.de>2013-05-23 19:09:59 +0200
commit33023fe6a009674830f21f575436115efbaaf22d (patch)
tree2449dcc4e4f101d29fe766fe8a8bfa230bf0d1d4 /usr/bin
parent123a9f36d68d140b95d6a504d928e9cb23df863d (diff)
add iwlist_env
Diffstat (limited to 'usr/bin')
-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..fcd9627d
--- /dev/null
+++ b/usr/bin/iwlist_env
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+count=0
+
+iwlist scan ${interface:-} 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