diff options
-rwxr-xr-x | usr/bin/autowifi | 19 | ||||
-rwxr-xr-x | usr/lib/autowifi/01open | 5 |
2 files changed, 18 insertions, 6 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi index 27782c3e..3fe9229b 100755 --- a/usr/bin/autowifi +++ b/usr/bin/autowifi @@ -21,6 +21,8 @@ connect_wifi(){ } iwlist_scan(){ + ifconfig $wifi up + count=0 iwlist scan ${1:-} 2>/dev/null | ( while read line; @@ -60,6 +62,8 @@ crack_wifi(){ encr=psk elif [ "$4" == on ]; then encr=wep + else + encr=open fi for hack in $(find /usr/lib/autowifi/ -type f); do key=$($hack $@); @@ -68,9 +72,10 @@ crack_wifi(){ 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_keys - echo "yay internet" - return 0 + (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 && return 0 fi fi done @@ -84,11 +89,17 @@ check_internet(){ 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}} done - } iwlist_scan > /tmp/${wifi}.scan loop_over_networks +while sleep 60; do + if ! check_internet; then + iwlist_scan > /tmp/${wifi}.scan + loop_over_networks + fi +done diff --git a/usr/lib/autowifi/01open b/usr/lib/autowifi/01open index da94cc98..f3b9640c 100755 --- a/usr/lib/autowifi/01open +++ b/usr/lib/autowifi/01open @@ -1,5 +1,6 @@ #!/bin/sh #ESSID MAC CHANNEL ENCRYPTION WPA WPA2 -if ! [ "$4" == "none" ]; then - exit 1 +if [ "$4" == "off" ]; then + exit 0 fi +exit 1 |