Skip to content

Instantly share code, notes, and snippets.

@Asoul
Created July 30, 2020 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Asoul/b1341b7223f56688bf8befd9cd3ee9be to your computer and use it in GitHub Desktop.
Save Asoul/b1341b7223f56688bf8befd9cd3ee9be to your computer and use it in GitHub Desktop.
Ptt daily auto login script
3 5 * * * /opt/apps/ptt.sh
#!/usr/bin/env expect
spawn ssh -oBatchMode=no -oStrictHostKeyChecking=no bbsu@ptt.cc
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 }
}
@Asoul
Copy link
Author

Asoul commented Jul 30, 2020

很久以前忘記是從哪裡用的一直跑的,要換機器了備份個

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment