summaryrefslogtreecommitdiffstats
path: root/usr/lib/autowifi/lib/plugin_core
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-06-26 13:26:56 +0200
committermakefu <github@syntax-fehler.de>2013-06-26 13:26:56 +0200
commitae52241d3802079628a87a534ce1853d1d46c82a (patch)
tree9b37886b3ce86da81febfe3594c8a31b5694870f /usr/lib/autowifi/lib/plugin_core
parent410ddbd1f77e2f65de6e6b6c86daf031e296028d (diff)
parenta0f4644017949e17b45f23a3870afa6f6c2823cb (diff)
Merge branch 'master' of github.com:krebscode/autowifi
Diffstat (limited to 'usr/lib/autowifi/lib/plugin_core')
-rw-r--r--usr/lib/autowifi/lib/plugin_core26
1 files changed, 20 insertions, 6 deletions
diff --git a/usr/lib/autowifi/lib/plugin_core b/usr/lib/autowifi/lib/plugin_core
index da003350..1b83b0c3 100644
--- a/usr/lib/autowifi/lib/plugin_core
+++ b/usr/lib/autowifi/lib/plugin_core
@@ -1,24 +1,38 @@
+#!/bin/sh
parse_plugin_args(){
[ $# -ne 4 ] && plugin_usage && exit 1
# convenience function to put args in ENV variables
ESSID="$1"
- MAC="$2"
+
+ # mac is returned without colon
+ MAC=$(printf "%s" "$2" | sed 's/://g')
+ # split up the mac address to vendor and private part
+ VENDOR_MAC=${MAC:0:6}
+ PRIVATE_MAC=${MAC:6:12}
CHANNEL="$3"
ENC="$4"
- if [ ${#MAC} -ne 17 ] ;then
+ if [ ${#MAC} -ne 12 ] ;then
echo "MAC malformed"
exit 1
fi
}
plugin_usage(){
cat << EOF
-usage: $0 ESSID MAC CHANNEL ENC WPA WPA2"
+usage: $0 ESSID MAC CHANNEL ENC"
ESSID - string
MAC - 00:11:22:33:44:55
- ENC - on | off
- WPA - 0 | 1
- WPA2 - 0 | 1
+ CHANNEL - 4
+ ENC - wpa
EOF
}
+
+check_vendor_mac(){
+ needle="$(printf $1 | tr '[A-Z]' '[a-z]')"
+ shift
+ for i in "$@";do
+ [ "$needle" == "$(printf $i | tr '[A-Z]' '[a-z]')" ] && return 0
+ done
+ return 1
+}