Skip to content

Instantly share code, notes, and snippets.

@manesec
Created September 9, 2024 17:04
Show Gist options
  • Save manesec/0c21cd99ac05595bbf68577865023534 to your computer and use it in GitHub Desktop.
Save manesec/0c21cd99ac05595bbf68577865023534 to your computer and use it in GitHub Desktop.
一個小脚本自動把賬號密碼自動輸入到openvpn裏面,無需每次都要手動輸入賬號密碼
#!/usr/bin/expect
if { $argc != 1 } {
puts "Usage: $argv0 <config.ovpn>"
exit 1
}
set configFile [lindex $argv 0]
set timeout -1
spawn openvpn --config $configFile
expect "Enter Auth Username:"
send -- "<username>\r"
expect "Enter Auth Password:"
send -- "<password>\r"
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment