【问题标题】:How to force reconnect to VOO_HOMESPOT on mac如何在 Mac 上强制重新连接到 VOO_HOMESPOT
【发布时间】:2020-03-04 08:14:46
【问题描述】:

VOO_HOMESPOT se déconnecte tout le temps。 Est-il possible d'éviter de taper le passeword tout le temps。

【问题讨论】:

  • Merci d'écrire ton post en anglais ;)

标签: bash macos shell


【解决方案1】:

Voici un batch sous mac pour forcer la 重新连接。在 peut faire un crontab dessus afin de garantir la 连接。


#!/bin/sh

USERNAME=*******
PASSWORD=******


ESSID="VOO_HOMESPOT"
TARGET=http://www.google.com/
AUTH_URL=https://wifree.voo.be/authenticate.html

VERBOSE=false

DATE=`date +%Y\/%m\/%d\ %H\:%M\:%S`
CURRENT_SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print $2}'`



if [ -n "$1" ] ; then 
    TALKIN=true
else
    TALKIN=false
fi 

if $VERBOSE ; then
    VERB=" -v"
else 
    VERB=-" -qO-"
fi


VOICE="-v Vicki"

if [ $CURRENT_SSID == $ESSID ]; then

    /usr/local/bin/wget -q --spider https://google.com

    if [ $? -eq 0 ] ; then
        echo "$DATE already connected"   
        if $TALKIN ; then 
            say "[[volm 0.2]] already connected" $VOICE
        fi
    else    

        if $TALKIN ; then 
            say "[[volm 0.2]] connection lost" $VOICE
        fi

        /usr/local/bin/wget $VERB --no-check-certificate --post-data="username=${USERNAME}&password=${PASSWORD}&rememberme=rememberme&accept=accept&target=${TARGET_URL}" $AUTH_URL | grep -q connected_success.png    

        if [ $? -eq 0 ] ; then
            echo "$DATE reconnect"
            if $TALKIN ; then 
                say "[[volm 0.2]] reconnect" $VOICE
            fi
        else

            echo "$DATE connection failed"
            if $TALKIN ; then 
                say "[[volm 0.2]] connection failed" $VOICE
            fi

            WRONG="identifiant incorrect"
            /usr/local/bin/wget $VERB --no-check-certificate --post-data="username=${USERNAME}&password=${PASSWORD}&rememberme=rememberme&accept=accept&target=${TARGET_URL}" $AUTH_URL | grep -q "$WRONG"

            if [ $? -eq 0 ] ; then
                echo "$DATE Wrong password"
                if $TALKIN ; then 
                    say "[[volm 0.2]] Wrong password" $VOICE
                fi
            fi

        fi
    fi
else
    if $TALKIN ; then   
        say "[[volm 0.2]] $CURRENT_SSID is not $ESSID" $VOICE
    fi
    echo "$DATE $CURRENT_SSID is not $ESSID"
fi

【讨论】:

    猜你喜欢
    • 2017-10-12
    • 1970-01-01
    • 2012-02-09
    • 2012-01-27
    • 2019-12-09
    • 2014-12-10
    • 1970-01-01
    • 2022-12-06
    相关资源
    最近更新 更多