diff options
author | lassulus <lassulus@googlemail.com> | 2013-05-24 15:05:22 +0200 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-05-24 15:05:22 +0200 |
commit | e28ab86654d9f70ea055929ae37d040783d4af9a (patch) | |
tree | a8833074880ba667c301d36b1805c1a589b597f1 /usr/bin | |
parent | f7e3a735078dd0a758066c9398489ca747ab4834 (diff) |
lots of stuff
Diffstat (limited to 'usr/bin')
-rwxr-xr-x | usr/bin/autowifi | 19 |
1 files changed, 15 insertions, 4 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 |