Re: [問題] Hinet付費熱點

看板 Broad_Band
作者 tomsawyer (安安)
時間 2024-02-29 19:51:22
留言 0則留言 (0推 0噓 0→)

一樣用他原本那個git 我是只改這樣 連iTaiwan 基本上只有auth的網址跟referer有點不同跟username/password不太一樣 然後我是cronjob */1 * * * * 你sh放的地方 供你參考 原著作為 https://github.com/jikker/dd-wrt-auto-login-CHT-Wi-Fi #!/bin/sh # default script path: /opt/script/login-cht-wifi.sh # default curl path: /opt/usr/bin/curl # original author: JustinTWD <[email protected]> # author: jikker <[email protected]> # date: 2017/07/17 # note: phone number account format: [email protected] # HN account format: [email protected] #要改的部分 USERNAME=ABCDEF123456@itw PASSWD=myegov LOGFILE=/tmp/cht-wifi.log TMPSESSION=/tmp/cht_session.tmp login_v2() { rm -f $TMPSESSION #wlan1 換成你自己的連到熱點的phy名稱 R1=$(/usr/bin/curl --interface wlan1 -c $TMPSESSION -k $(/usr/bin/curl -- interface wlan1 -Ls -o /dev/null -w %{url_effective} http://google.com) 2>&1 | grep redirect_url= | awk -F"'" '{print $2}') R2=$(/usr/bin/curl --interface wlan1 -b $TMPSESSION -c $TMPSESSION -k -i $ R1 2>&1 | grep Location | awk '{print $2}') #這邊的資訊就是觀察一下web登入,他實際上post了甚麼鬼出去 #下面是你要自己填的東西 /usr/bin/curl --interface wlan1 -b $TMPSESSION -c $TMPSESSION -k \ -H "Referer: https://auth.itaiwan.gov.tw/" \ -d username=$USERNAME -d password=$PASSWD \ https://wlangw.hinet.net/v2_0/itaiwan_auth/auth_page.php /usr/bin/logger -p notice -t iTaiwanLogin "login to iTaiwan" } main() { testing=$(/usr/bin/curl --interface wlan1 -I www.google.com.tw | grep "200 OK") #echo "=============================================" if [ "$testing" != "" ]; then echo "$(date) wifi logined." elif [ "$1" == "" ]; then echo "$(date) You need login CHT Wi-Fi PWLAN." # echo "$(date) You need login CHT Wi-Fi PWLAN." >>$LOGFILE login_v2 fi } 另外提到的wispr,是這種熱點登入可能會有的一個通用登入方式 https://github.com/wichert/wispr 你如果是刷openwrt 可以裝個python玩一下 他大概就是去找登入網頁有沒有WISPAccessGatewayParam這個端點,有的話就透過那個endpoint登入 以前的HTC手機有內建這個 --
※ 批踢踢實業坊(ptt.cc), 來自: 104.28.223.57 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Broad_Band/M.1709207484.A.034.html

您可能感興趣