summaryrefslogtreecommitdiffstats
path: root/recon/autowifi/usr/bin
diff options
context:
space:
mode:
Diffstat (limited to 'recon/autowifi/usr/bin')
-rwxr-xr-xrecon/autowifi/usr/bin/autowifi177
-rwxr-xr-xrecon/autowifi/usr/bin/autowifi_old65
-rwxr-xr-xrecon/autowifi/usr/bin/inspector_wifi75
-rwxr-xr-xrecon/autowifi/usr/bin/iwlist_env33
4 files changed, 0 insertions, 350 deletions
diff --git a/recon/autowifi/usr/bin/autowifi b/recon/autowifi/usr/bin/autowifi
deleted file mode 100755
index 6b9a090c..00000000
--- a/recon/autowifi/usr/bin/autowifi
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/bin/sh
-cd $(dirname $(readlink -f $0))
-
-
-interface=${interface:-wlan0}
-root=${root:-../../}
-crackdir=$root/usr/lib/autowifi/plugins
-wifi_keys=$root/etc/autowifi/wifi_keys
-wifi_log=$root/var/log/autowifi.log
-painmode=${painmode:-}
-
-# exists() run_hooks()
-. $root/usr/lib/autowifi/lib/core
-
-
-. $root/usr/lib/autowifi/lib/network
-
-# start_wpa_supplicant()
-. $root/usr/lib/autowifi/lib/wpa_supplicant
-
-
-connect(){
- #mac ssid encryption key
-
- run_hooks interface pre
- run_hooks profile pre
-
- connect_wifi "$@"
-
- ip_start dhcp
-
- if check_gateway && check_internet; then
- echo yay internet >&2
-
- run_hooks interface post
- run_hooks profile post
-
- write_profile "$@"
- return 0
- fi
- return 1
-}
-write_profile(){
- bandw=$(check_bandwidth)
- ( cat $wifi_keys | grep -v '^#' | grep -v "|$1|" ; echo "$2|$1|$bandw|$4" ) | ( echo "#SSID|MAC|BANDWIDTH|KEY";sort )| uniq > "${wifi_keys}2"
- mv "${wifi_keys}2" "$wifi_keys"
-}
-
-
-find_count_of_ssid(){
- c=0
- for i in `seq 1 $WIFI_COUNT`; do
- eval SSID=\${ESSID_${i}}
- if [ "$SSID" = "$1" ]; then
- c+=1
- echo "$i"
- fi
- done
- if [ $c -eq 0 ];then
- exit 1
- fi
- exit 0
-}
-
-
-connect_to_network_by_ssid(){
- find_count_of_ssid "$1" | (while read i
- do
- loop_over_cracks "$i" && exit 0
- done;exit 1)
- if [ $? -eq 0 ]; then
- exit 0
- fi
- echo "no network found :("
- exit 1
-}
-
-connect_with_pw(){
- find_count_of_ssid "$1" | (while read i
- do
- KEY="$2"
- eval connect \"\${MAC_${i}}\" \"\${ESSID_${i}}\" \${ENCRYPTION_${i}} \"\${KEY}\"
- if [ $? -eq 0 ]; then
- exit 0
- fi
- done;exit 1)
-}
-wifi_init(){
- wpa_supplicant_is_usable || start_wpa_supplicant /tmp/autowifi.wpa_supplicant
- wifi_scan > /tmp/${interface}.scan
- . /tmp/${interface}.scan
-}
-loop_over_networks(){
-
- wifi_init
- for i in `seq 1 $WIFI_COUNT`; do
- loop_over_cracks "$i"
- if [ $? -eq 0 ]; then
- return 0
- fi
- done
-}
-
-loop_over_cracks(){
- i=$1
- KEY=''
- for crack in $(find $crackdir -type f | sort -u); do
- KEY="$(eval root=$root painmode=$painmode \$crack \"\${ESSID_${i}}\" \"\${MAC_${i}}\" \${FREQ_${i}} \${ENCRYPTION_${i}})"
- if [ $? -eq 0 ]; then
- eval connect \"\${MAC_${i}}\" \"\${ESSID_${i}}\" \${ENCRYPTION_${i}} \"\${KEY}\"
- if [ $? -eq 0 ]; then
- return 0
- fi
- fi
- done
- return 1
-}
-loop_cracks_over_networks(){
- wifi_init
- for crack in $(find $crackdir -type f | sort -u); do
- for i in `seq 1 $WIFI_COUNT`; do
- KEY="$(eval root=$root \$crack \"\${ESSID_${i}}\" \"\${MAC_${i}}\" \${FREQ_${i}} \${ENCRYPTION_${i}})"
- if [ $? -eq 0 ]; then
- eval connect \"\${MAC_${i}}\" \"\${ESSID_${i}}\" \${ENCRYPTION_${i}} \"\${KEY}\"
- if [ $? -eq 0 ]; then
- return 0
- fi
- fi
- done
- done
-
-}
-
-#scan_all(){
-# for i in `seq 1 $WIFI_COUNT`; do
-# loop_over_cracks $i
-# done
-#}
-#
-#scan_unscanned(){
-# find_unscanned_networks | (while read i
-# do
-# loop_over_cracks $i
-# done)
-#}
-
-#find_unscanned_networks(){
-# #TODO broken
-# for i in `seq 1 $WIFI_COUNT`; do
-# eval SSID=\${ESSID_${i}}
-# eval MAC=\${MAC_${i}}
-# cat $wifi_stats 2>/dev/null | (while IFS='|' read SSID MAC BANDW KEY; do
-# if [ "$1" = "$SSID" -a "$2" = "$MAC" ]; then
-# continue
-# fi
-# done; echo $i)
-# done
-# exit 0
-#}
-
-wifi_init
-if [ -n "$2" ]; then
- echo connecting to $1 with pw $2
- connect_with_pw "$1" "$2"
-elif [ -n "$1" ]; then
- echo connecting to $1
- connect_to_network_by_ssid "$1"
-else
- echo looping network now
- check_internet || loop_cracks_over_networks
-
- while sleep 10; do
- if ! check_gateway; then
- loop_cracks_over_networks
- fi
- done
-fi
diff --git a/recon/autowifi/usr/bin/autowifi_old b/recon/autowifi/usr/bin/autowifi_old
deleted file mode 100755
index 55eaefcd..00000000
--- a/recon/autowifi/usr/bin/autowifi_old
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh -x
-# States (LED):
-# Blinking - running wifi plugins
-# Turned off - connected to wifi
-# Turned on - waiting for next scan round
-
-wifi=wlan0
-iface=@wifi-iface[0]
-radio=$(uci get wireless.${iface}.device)
-
-# for connect_wifi
-. /usr/lib/autowifi/lib/openwrt
-
-# for iwlist_scan
-. /usr/lib/autowifi/lib/iwlist
-
-# for check_internet and check_gateway
-. /usr/lib/autowifi/lib/network
-
-crack_wifi(){
- #SSID MAC CHANNEL ENCRYPTION WPA WPA2
- all_led timer
- if [ "$4" == off ];then
- encr=open
- elif [ "$6" -eq 1 ]; then
- encr=psk2
- elif [ "$5" -eq 1 ]; then
- encr=psk
- elif [ "$4" == on ]; then
- encr=wep
- fi
- for hack in $(find /usr/lib/autowifi/plugins -type f); do
- key=$($hack "$@");
- ret=$?
- if [ $ret -eq 0 ];then
- connect_wifi "$3" "$1" $encr "$key"
- sleep 20
- if check_gateway; then
- (cat /etc/autowifi/wifi_keys | grep -v "$1|$2|" ; echo "$1|$2|$key" ) | sort | uniq > /etc/autowifi/wifi_keys2
- mv /etc/autowifi/wifi_keys2 /etc/autowifi/wifi_keys
- echo "yay gateway"
- check_internet && all_led none && return 0
- fi
- fi
- done
- return 1
-}
-loop_over_networks(){
- . /tmp/${wifi}.scan
- for i in `seq 1 $WIFI_COUNT`; do
- eval grep -q \${MAC_${i}} /etc/autowifi/blacklist && continue
- eval crack_wifi \"\${ESSID_${i}}\" \"\${MAC_${i}}\" \${CHANNEL_${i}} \${ENCRYPTION_${i}} \${WPA_${i}} \${WPA2_${i}} && break
- done
-}
-
-iwlist_scan > /tmp/${wifi}.scan
-loop_over_networks
-
-while sleep 60; do
- if ! check_internet; then
- all_led on
- iwlist_scan > /tmp/${wifi}.scan
- loop_over_networks
- fi
-done
diff --git a/recon/autowifi/usr/bin/inspector_wifi b/recon/autowifi/usr/bin/inspector_wifi
deleted file mode 100755
index 17818b44..00000000
--- a/recon/autowifi/usr/bin/inspector_wifi
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/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
diff --git a/recon/autowifi/usr/bin/iwlist_env b/recon/autowifi/usr/bin/iwlist_env
deleted file mode 100755
index 29112ff3..00000000
--- a/recon/autowifi/usr/bin/iwlist_env
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/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)