Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tinti/ff90edeee5bdfb888aa55b40f61e13df to your computer and use it in GitHub Desktop.

Select an option

Save tinti/ff90edeee5bdfb888aa55b40f61e13df to your computer and use it in GitHub Desktop.
SSH to HP 1920 and enable cmdline-mode
#!/usr/bin/expect -f
set timeout 60
set host [lindex $argv 0]
stty -echo
send_user -- "Password for $host: "
expect_user -re "(.*)\n"
send_user "\n"
stty echo
set password $expect_out(1,string)
eval spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no $host
expect "assword:"
send "$password\r"
# Enable Command Line Mode
send "_cmdline-mode on\r"
expect "\[Y\/N\]"
send "Y\r"
expect "assword:"
send "Jinhua1920unauthorized\r"
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment