Created
September 9, 2024 17:04
-
-
Save manesec/0c21cd99ac05595bbf68577865023534 to your computer and use it in GitHub Desktop.
一個小脚本自動把賬號密碼自動輸入到openvpn裏面,無需每次都要手動輸入賬號密碼
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/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