Skip to content

Instantly share code, notes, and snippets.

@ipcjk
Created January 18, 2018 13:50
Show Gist options
  • Select an option

  • Save ipcjk/532178f69341ac413fc06ed781b5e018 to your computer and use it in GitHub Desktop.

Select an option

Save ipcjk/532178f69341ac413fc06ed781b5e018 to your computer and use it in GitHub Desktop.
save hp procurve switch via telnet and exp
#!/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