summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2013-05-23 20:01:57 +0200
committerlassulus <lassulus@googlemail.com>2013-05-23 20:01:57 +0200
commit1647448443b3895d9f4125c76e68ac8e98477aeb (patch)
treef09d673c87fa5560410e989e08ac90caa77e9652
parent640e5c566585c04bfa4cdfbf8d89c34d8626108f (diff)
parent48c1d8fb772569f38878c0e61e413ed0b3d3cd96 (diff)
Merge branch 'master' of github.com:krebscode/minikrebs
-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)