diff options
author | lassulus <lassulus@googlemail.com> | 2013-05-24 13:24:52 +0200 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-05-24 13:24:52 +0200 |
commit | 631986deaf81a4641578d1d878f66d2e1a622396 (patch) | |
tree | 618c2175ea1030a7d3d52fa07c7c4519143f1785 /usr/bin/autowifi | |
parent | 5f7f912c13b1fc137b7a29a4083082d9efcc9b40 (diff) |
new profiles & autowifi
Diffstat (limited to 'usr/bin/autowifi')
-rwxr-xr-x | usr/bin/autowifi | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi index 90a584de..3c3444df 100755 --- a/usr/bin/autowifi +++ b/usr/bin/autowifi @@ -54,28 +54,37 @@ iwlist_scan(){ done; echo WIFI_COUNT=$count) } crack_wifi(){ - if $6;then + if [ -n "$6" ];then encr=psk2 - elif $5; then + elif [ -n "$5" ]; then encr=psk - elif [ $4 == on ]; then + elif [ "$4" == on ]; then encr=wep fi for hack in $(find /usr/lib/autowifi/ -type f); do key=$($hack $@); - if ! [ $key -eq 1 ];then + ret=$? + if [ $ret -eq 0 ];then connect_wifi $3 $1 $encr $key - break + sleep 20 + if check_gateway; then + (cat /etc/autowifi/wifi_keys; echo "$1|$2|$key" ) | sort | uniq >> /etc/autowifi/wifi_keys + echo "yay internet" + return 0 + fi fi done } +check_gateway(){ + ping -c 1 -w 5 $(ip route | awk '/default/{print $3}') +} check_internet(){ wget -O- --spider http://google.de/index.html } loop_over_networks(){ . /tmp/${wifi}.scan for i in `seq 1 $WIFI_COUNT`; do - crack_wifi \${ESSID_${i}} \${MAC_${i}} \${CHANNEL_${i}} \${ENCRYPTION_${i}} \${WPA_${i}} \${WPA2_${i}} + eval crack_wifi \${ESSID_${i}} \${MAC_${i}} \${CHANNEL_${i}} \${ENCRYPTION_${i}} \${WPA_${i}} \${WPA2_${i}} done } |