Created
June 30, 2020 14:40
-
-
Save dmd/e6a269eb38ce90cf100f17ee905d2995 to your computer and use it in GitHub Desktop.
This file contains 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 | |
trap { | |
set rows [stty rows] | |
set cols [stty columns] | |
stty rows $rows columns $cols < $spawn_out(slave,name) | |
} WINCH | |
set dest [lindex $argv 0]; | |
# are we already on vpn? | |
spawn host ogawa.mclean.harvard.edu | |
expect eof | |
catch wait result | |
if { [lindex $result 3] == 1 } { | |
spawn ssh -A -oStrictHostKeyChecking=no -oCheckHostIP=no -J dd328@ssh.partners.org $dest | |
set prompt ":|#|\\\$" | |
interact -o -nobuffer -re $prompt return | |
send "my password\r" | |
interact | |
} else { | |
spawn ssh $dest | |
interact | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment