Created
May 29, 2016 13:09
-
-
Save leonroy/a7a53cb1b91e90fe9fd3eb9776ac3f29 to your computer and use it in GitHub Desktop.
SSH to HP 1920 and enable cmdline-mode
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] | |
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
Uh oh!
There was an error while loading. Please reload this page.