summaryrefslogtreecommitdiffstats
path: root/usr/bin/inspector_wifi
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/inspector_wifi
parent120114ad12a212331e9e790305a4ab3afdc15857 (diff)
parent6a9beb12dad44b5e1efa984b112c7a6b8c13a118 (diff)
Merge remote-tracking branch 'inspector_wifi/wifi_scanner'
Conflicts: .gitignore
Diffstat (limited to 'usr/bin/inspector_wifi')
-rwxr-xr-xusr/bin/inspector_wifi75
1 files changed, 75 insertions, 0 deletions
diff --git a/usr/bin/inspector_wifi b/usr/bin/inspector_wifi
new file mode 100755
index 00000000..17818b44
--- /dev/null
+++ b/usr/bin/inspector_wifi
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Usage; sudo iwlist wlan0 scan | ./inspector_wifi
+#
+#
+set -eu
+
+cd "$(dirname "$(readlink -f "$0")")"
+echo "waiting for iwlist scan data..." >&2
+
+crack_wifi(){
+ for i in ../lib/autowifi/plugins/*;do
+ if RET=$(./$i "$@" 2>/dev/null);then
+ echo "$@ - with crack $i succeeded - Key is $RET"
+ fi
+ done
+}
+
+shell_escape(){
+ sed 's/./\\&/g'
+}
+remove_quotes(){
+ sed 's/^"\|"$//g'
+}
+
+
+iwlist_scan_parser(){
+ count=0
+ while read line;
+ do
+ case "$line" in
+
+ *"Cell "*)
+ if [ $count -ne 0 ];then
+ crack_wifi "$ESSID" $MAC $CHANNEL any_encryption
+ fi
+ WPA=0
+ WPA2=0
+ : $((count+=1))
+ MAC=${line#*Address: }
+ ;;
+ *Channel:*)
+ CHANNEL=${line#*:}
+ ;;
+ *Quality=*)
+ QUALITY="`printf '%s' ${line#*Quality=} | cut -d/ -f 1`"
+ ;;
+ *"Encryption key:"*)
+ ENCRYPTION=${line#*key:}
+ ;;
+ *ESSID:*)
+ ESSID=$(echo "${line#*ESSID:}" | remove_quotes)
+ ;;
+ *"IE: IEEE 802.11i/WPA2"*)
+ WPA2=1
+ ;;
+ *"IE: WPA Version 1"*)
+ WPA=1
+ ;;
+ *);; #important, do not delete!
+ esac
+ done;
+ crack_wifi "$ESSID" $MAC $CHANNEL any_encryption
+ echo WIFI_COUNT=$count
+}
+
+wifi_init(){
+ iwlist_scan_parser
+}
+
+loop_networks(){
+ for i in `seq 1 $WIFI_COUNT`; do
+ loop_over_cracks "$i"
+ done
+}
+wifi_init