summaryrefslogtreecommitdiffstats
path: root/usr/bin/autowifi
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2013-05-24 13:24:52 +0200
committerlassulus <lassulus@googlemail.com>2013-05-24 13:24:52 +0200
commit631986deaf81a4641578d1d878f66d2e1a622396 (patch)
tree618c2175ea1030a7d3d52fa07c7c4519143f1785 /usr/bin/autowifi
parent5f7f912c13b1fc137b7a29a4083082d9efcc9b40 (diff)
new profiles & autowifi
Diffstat (limited to 'usr/bin/autowifi')
-rwxr-xr-xusr/bin/autowifi21
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
}