From ed73fba46289f4af60422b2d267ba40834ca97ca Mon Sep 17 00:00:00 2001
From: makefu <github@syntax-fehler.de>
Date: Sat, 25 May 2013 20:50:49 +0200
Subject: add plugins folder

---
 usr/bin/autowifi                   |  2 +-
 usr/lib/autowifi/00profile         |  8 --------
 usr/lib/autowifi/01open            |  6 ------
 usr/lib/autowifi/easybox           | 38 --------------------------------------
 usr/lib/autowifi/plugins/00profile |  8 ++++++++
 usr/lib/autowifi/plugins/01open    |  6 ++++++
 usr/lib/autowifi/plugins/02easybox | 38 ++++++++++++++++++++++++++++++++++++++
 7 files changed, 53 insertions(+), 53 deletions(-)
 delete mode 100755 usr/lib/autowifi/00profile
 delete mode 100755 usr/lib/autowifi/01open
 delete mode 100755 usr/lib/autowifi/easybox
 create mode 100755 usr/lib/autowifi/plugins/00profile
 create mode 100755 usr/lib/autowifi/plugins/01open
 create mode 100755 usr/lib/autowifi/plugins/02easybox

(limited to 'usr')

diff --git a/usr/bin/autowifi b/usr/bin/autowifi
index 28b24808..24ffb461 100755
--- a/usr/bin/autowifi
+++ b/usr/bin/autowifi
@@ -84,7 +84,7 @@ crack_wifi(){
     elif [ "$4" == on ]; then
         encr=wep
     fi
-    for hack in $(find /usr/lib/autowifi/ -type f); do
+    for hack in $(find /usr/lib/autowifi/plugins -type f); do
         key=$($hack "$@");
         ret=$?
         if [ $ret -eq 0 ];then
diff --git a/usr/lib/autowifi/00profile b/usr/lib/autowifi/00profile
deleted file mode 100755
index fe42470b..00000000
--- a/usr/lib/autowifi/00profile
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#ESSID MAC CHANNEL ENCRYPTION WPA WPA2
-cat /etc/autowifi/wifi_keys | (while IFS='|' read SSID MAC KEY; do
-    if [ "$1" == "$SSID" -a "$2" == "$MAC" ]; then
-        echo $KEY
-        exit 0
-    fi
-done; exit 1)
diff --git a/usr/lib/autowifi/01open b/usr/lib/autowifi/01open
deleted file mode 100755
index f3b9640c..00000000
--- a/usr/lib/autowifi/01open
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-#ESSID MAC CHANNEL ENCRYPTION WPA WPA2
-if [ "$4" == "off" ]; then
-    exit 0
-fi
-exit 1
diff --git a/usr/lib/autowifi/easybox b/usr/lib/autowifi/easybox
deleted file mode 100755
index e5323977..00000000
--- a/usr/lib/autowifi/easybox
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-#ESSID MAC CHANNEL ENCRYPTION WPA WPA2
-if ! echo $1 | grep -qi Easybox; then
-    exit 1
-else
-    MAC=${2?\$2 must be MAC}
-
-    # Take the last 2 Bytes of the MAC-Address (0B:EC), and convert it to decimal.
-
-    take5=${MAC:12}
-    last4=${take5/:/}
-
-    # Fill up to 4 places with zeros, if necessary:
-    deci=$(printf "%04d" "0x$last4" | sed 's/.*\(....\)/\1/;s/./& /g')
-    #echo M4: ${deci[@]}
-    #
-    # The digits M9 to M12 are just the last digits (9.-12.) of the MAC:
-    hexi=$(echo ${MAC:12:5} | sed 's/://;s/./& /g')
-    #echo 'M4 (Hex): ' ${hexi[@]}
-    # K1 = last byte of (d0 + d1 + h2 + h3)
-    # K2 = last byte of (h0 + h1 + d2 + d3)
-    c1=$(printf "%d + %d + %d + %d" ${deci:0:1} ${deci:2:1} 0x${hexi:4:1} 0x${hexi:6:1})
-    c2=$(printf "%d + %d + %d + %d" 0x${hexi:0:1} 0x${hexi:2:1} ${deci:4:1} ${deci:6:1})
-    K1=$((($c1)%16))
-    K2=$((($c2)%16))
-    #printf "K1: %x\n" $K1
-    #printf "K2: %x\n" $K2
-    X1=$((K1^${deci:6:1}))
-    X2=$((K1^${deci:4:1}))
-    X3=$((K1^${deci:2:1}))
-    Y1=$((K2^0x${hexi:2:1}))
-    Y2=$((K2^0x${hexi:4:1}))
-    Y3=$((K2^0x${hexi:6:1}))
-    Z1=$((0x${hexi:4:1}^${deci:6:1}))
-    Z2=$((0x${hexi:6:1}^${deci:4:1}))
-    Z3=$((K1^K2))
-    printf "%x%x%x%x%x%x%x%x%x\n" $X1 $Y1 $Z1 $X2 $Y2 $Z2 $X3 $Y3 $Z3 | tr a-f A-F
-fi
diff --git a/usr/lib/autowifi/plugins/00profile b/usr/lib/autowifi/plugins/00profile
new file mode 100755
index 00000000..fe42470b
--- /dev/null
+++ b/usr/lib/autowifi/plugins/00profile
@@ -0,0 +1,8 @@
+#!/bin/sh
+#ESSID MAC CHANNEL ENCRYPTION WPA WPA2
+cat /etc/autowifi/wifi_keys | (while IFS='|' read SSID MAC KEY; do
+    if [ "$1" == "$SSID" -a "$2" == "$MAC" ]; then
+        echo $KEY
+        exit 0
+    fi
+done; exit 1)
diff --git a/usr/lib/autowifi/plugins/01open b/usr/lib/autowifi/plugins/01open
new file mode 100755
index 00000000..f3b9640c
--- /dev/null
+++ b/usr/lib/autowifi/plugins/01open
@@ -0,0 +1,6 @@
+#!/bin/sh
+#ESSID MAC CHANNEL ENCRYPTION WPA WPA2
+if [ "$4" == "off" ]; then
+    exit 0
+fi
+exit 1
diff --git a/usr/lib/autowifi/plugins/02easybox b/usr/lib/autowifi/plugins/02easybox
new file mode 100755
index 00000000..e5323977
--- /dev/null
+++ b/usr/lib/autowifi/plugins/02easybox
@@ -0,0 +1,38 @@
+#!/bin/sh
+#ESSID MAC CHANNEL ENCRYPTION WPA WPA2
+if ! echo $1 | grep -qi Easybox; then
+    exit 1
+else
+    MAC=${2?\$2 must be MAC}
+
+    # Take the last 2 Bytes of the MAC-Address (0B:EC), and convert it to decimal.
+
+    take5=${MAC:12}
+    last4=${take5/:/}
+
+    # Fill up to 4 places with zeros, if necessary:
+    deci=$(printf "%04d" "0x$last4" | sed 's/.*\(....\)/\1/;s/./& /g')
+    #echo M4: ${deci[@]}
+    #
+    # The digits M9 to M12 are just the last digits (9.-12.) of the MAC:
+    hexi=$(echo ${MAC:12:5} | sed 's/://;s/./& /g')
+    #echo 'M4 (Hex): ' ${hexi[@]}
+    # K1 = last byte of (d0 + d1 + h2 + h3)
+    # K2 = last byte of (h0 + h1 + d2 + d3)
+    c1=$(printf "%d + %d + %d + %d" ${deci:0:1} ${deci:2:1} 0x${hexi:4:1} 0x${hexi:6:1})
+    c2=$(printf "%d + %d + %d + %d" 0x${hexi:0:1} 0x${hexi:2:1} ${deci:4:1} ${deci:6:1})
+    K1=$((($c1)%16))
+    K2=$((($c2)%16))
+    #printf "K1: %x\n" $K1
+    #printf "K2: %x\n" $K2
+    X1=$((K1^${deci:6:1}))
+    X2=$((K1^${deci:4:1}))
+    X3=$((K1^${deci:2:1}))
+    Y1=$((K2^0x${hexi:2:1}))
+    Y2=$((K2^0x${hexi:4:1}))
+    Y3=$((K2^0x${hexi:6:1}))
+    Z1=$((0x${hexi:4:1}^${deci:6:1}))
+    Z2=$((0x${hexi:6:1}^${deci:4:1}))
+    Z3=$((K1^K2))
+    printf "%x%x%x%x%x%x%x%x%x\n" $X1 $Y1 $Z1 $X2 $Y2 $Z2 $X3 $Y3 $Z3 | tr a-f A-F
+fi
-- 
cgit v1.2.3