diff options
author | lassulus <lassulus@googlemail.com> | 2013-06-30 14:25:29 +0200 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-06-30 14:25:29 +0200 |
commit | af1d85fa6b390f8119c4ba695b3f075bd726806e (patch) | |
tree | 922822531854bfe6caf4a08e2b13a3cd400aade9 /usr/bin | |
parent | 1d591aa1f4af30f41f2d44656d5b86e73048cffd (diff) | |
parent | b99bbe256c030cec78b1c96d08eb02860dda911c (diff) |
Merge branch 'master' of github.com:krebscode/autowifi
Diffstat (limited to 'usr/bin')
-rwxr-xr-x | usr/bin/autowifi | 8 | ||||
-rwxr-xr-x | usr/bin/autowifi_dryrun | 42 |
2 files changed, 22 insertions, 28 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi index 5d9cad16..07786d67 100755 --- a/usr/bin/autowifi +++ b/usr/bin/autowifi @@ -63,7 +63,6 @@ find_count_of_ssid(){ connect_to_network_by_ssid(){ - wifi_init find_count_of_ssid "$1" | (while read i do loop_over_cracks "$i" && exit 0 @@ -76,7 +75,6 @@ connect_to_network_by_ssid(){ } connect_with_pw(){ - wifi_init find_count_of_ssid "$1" | (while read i do KEY="$2" @@ -92,8 +90,8 @@ wifi_init(){ . /tmp/${interface}.scan } loop_over_networks(){ - wifi_init + wifi_init for i in `seq 1 $WIFI_COUNT`; do loop_over_cracks "$i" if [ $? -eq 0 ]; then @@ -159,9 +157,7 @@ loop_cracks_over_networks(){ # exit 0 #} - - - +wifi_init if [ -n "$2" ]; then echo connecting to $1 with pw $2 connect_with_pw "$1" "$2" diff --git a/usr/bin/autowifi_dryrun b/usr/bin/autowifi_dryrun index 1df94119..c9867106 100755 --- a/usr/bin/autowifi_dryrun +++ b/usr/bin/autowifi_dryrun @@ -2,30 +2,23 @@ # ENV: # the root directory (e.g. root=$PWD/../../ if run from here ) cd $(dirname $(readlink -f $0)) -root=${root:-/} -wifi=${wifi:-wlan0} - test "${1:-}" = 'quiet' && exec 2>&- -# for iwlist_scan -. $root/usr/lib/autowifi/lib/iwlist +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 -# . $ROOT/usr/lib/autowifi/lib/ +# exists() run_hooks() +. $root/usr/lib/autowifi/lib/core -# for check_internet and check_gateway -# . /usr/lib/autowifi/lib/network +# start_wpa_supplicant() +. $root/usr/lib/autowifi/lib/wpa_supplicant crack_wifi(){ - #SSID MAC CHANNEL ENCRYPTION WPA WPA2 - 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 + #SSID MAC FREQ ENCRYPTION + ALL_RET=1 for hack in $(find $root/usr/lib/autowifi/plugins -type f | sort -n); do printf "%s" "Trying $(basename $hack) against $1 : " >&2 @@ -41,13 +34,18 @@ crack_wifi(){ done return $ALL_RET } +wifi_init(){ + wpa_supplicant_is_usable || start_wpa_supplicant /tmp/autowifi.wpa_supplicant + wifi_scan > /tmp/${interface}.scan + . /tmp/${interface}.scan +} loop_over_networks(){ - . /tmp/${wifi}.scan - echo "SSID:MAC:CHANNEL:ENCRYPTION:key" + wifi_init + + echo "SSID:MAC:FREQ:ENCRYPTION:key" for i in `seq 1 $WIFI_COUNT`; do - eval crack_wifi \"\${ESSID_${i}}\" \${MAC_${i}} \${CHANNEL_${i}} \${ENCRYPTION_${i}} \${WPA_${i}} \${WPA2_${i}} + eval crack_wifi \"\${ESSID_${i}}\" \${MAC_${i}} \${FREQ_${i}} \${ENCRYPTION_${i}} done } -iwlist_scan > /tmp/${wifi}.scan loop_over_networks |