Created
January 18, 2018 13:50
-
-
Save ipcjk/532178f69341ac413fc06ed781b5e018 to your computer and use it in GitHub Desktop.
save hp procurve switch via telnet and exp
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 -f | |
| set timeout 60 | |
| set host [lindex $argv 0] | |
| set password [lindex $argv 1] | |
| set mac [lindex $argv 2] | |
| log_user 1 | |
| spawn telnet $host | |
| #expect "Press any key to continue" | |
| expect "*" | |
| send "y\n" | |
| expect "Password" | |
| send "$password\n" | |
| expect "#" | |
| send "terminal length 1000\n" | |
| expect "#" | |
| send "show running-config\n" | |
| expect "#" | |
| send "logout\n" | |
| expect "Do you want" | |
| send "y\n" | |
| interact | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment