Created
July 30, 2020 16:41
-
-
Save Asoul/b1341b7223f56688bf8befd9cd3ee9be to your computer and use it in GitHub Desktop.
Ptt daily auto login script
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 characters
3 5 * * * /opt/apps/ptt.sh |
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 characters
#!/usr/bin/env expect | |
spawn ssh -oBatchMode=no -oStrictHostKeyChecking=no [email protected] | |
set BBS_ID "YOUR_ID" | |
set BBS_PW "YOUR_PASSWORD" | |
expect { | |
"請輸入代號" { send "$BBS_ID\r" ; exp_continue } | |
"請輸入您的密碼" { send "$BBS_PW\r" ; exp_continue } | |
"您想刪除其他重複登入的連線嗎" { send "N\r" ; exp_continue } | |
"您要刪除以上錯誤嘗試的記錄嗎" { send "N\r" ; exp_continue } | |
"密碼不對喔" { exit } | |
"裡沒有這個人啦" { exit } | |
"請勿頻繁登入以免造成系統過度負荷" { send "\r" ; exp_continue } | |
"請按任意鍵繼續" { send "\r" ; exp_continue } | |
"oodbye" { exit } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
很久以前忘記是從哪裡用的一直跑的,要換機器了備份個