Skip to content

Instantly share code, notes, and snippets.

@jtl999
Created November 6, 2017 00:50
Show Gist options
  • Save jtl999/bd3ca25aa64d48d0787c61521abe7a4f to your computer and use it in GitHub Desktop.
Save jtl999/bd3ca25aa64d48d0787c61521abe7a4f to your computer and use it in GitHub Desktop.
connect-1910
#!/usr/bin/expect
set PASSWORD "changeme" # Change this
set HOST "switch-1910" # host in .ssh/config
spawn ssh $HOST
expect "password: "
send "$PASSWORD\r"
expect "Copyright (c) 2010-2017 Hewlett Packard Enterprise Development LP" # Could use a more generic detection for the prompt.
send "_cmdline-mode on\r"
expect "All commands can be displayed and executed."
send "Y\r"
expect "Please input password:"
send "512900\r" # At least on my unit (firmware: 1519P03)
expect "Warning:"
send "system-view\r"
interact # Drop into SSH session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment