Last active
December 16, 2019 02:30
-
-
Save tossmilestone/c75e1b5244460dd49ae1f1565dc6defd to your computer and use it in GitHub Desktop.
ssh with password from a file
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
dev MTIzNDU2Cg== |
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 | |
set timeout 20 | |
set cmd [lrange $argv 1 end] | |
set password [lindex $argv 0] | |
eval spawn $cmd | |
set output [exec grep $password pwfile | awk {{print $2;}} | base64] | |
expect "assword:" | |
send "$output\r"; | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
pwfile
format is:every line is a single password config. You can add several password lines with different names.
Run: