Last active
November 30, 2023 05:04
-
-
Save darren/ca7e8bfa44ddd27d472f to your computer and use it in GitHub Desktop.
Revisions
-
darren revised this gist
May 5, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/env bash USERNAME= #改成你的读者卡号 PASSWORD= #改成你的读者卡密码 LOGINURL="http://192.168.180.11:8080/nlcwlan/QueryGuest" -
darren renamed this gist
May 5, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
darren created this gist
May 5, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ #!/usr/bin/env bash USERNAME= #改成你的读者卡号 PASSWORD= #改成你的读者卡号密码 LOGINURL="http://192.168.180.11:8080/nlcwlan/QueryGuest" PASSWORD=$(echo $PASSWORD|base64) UA="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)" function test_conn { server=$1 ping -c 3 -t 5 $server >/dev/null 2>&1 res=$? if [[ $res == 0 ]] ;then return $res else return -1 fi } function try_conn { res=$(curl -d "id_userPwd=$PASSWORD&id_userName=$USERNAME" "$LOGINURL" --user-agent "$UA" 2>/dev/null) if [[ $res =~ "success" ]]; then printf "\x1b[1;33mo\x1b[m" # o else printf "\x1b[3;31m!\x1b[m" # ! fi } let i=0 while :; do let 'o=i%16, i=i+1' if test_conn 60.247.28.1; then [ $o -eq 0 ] && printf "\x1b[32m.\x1b[m" # . elif test_conn 192.168.180.11; then # Login server is OK # echo "No Connection, try Connect" try_conn else #echo "No Connection and login Server not available" [ $o -eq 0 ] && printf "\x1b[1;31mx\x1b[m" # x fi sleep 1 done exit 0;