Forked from leonroy/ssh-hp1920-enable-cmdline-mode.exp
Created
September 16, 2016 16:04
-
-
Save tinti/ff90edeee5bdfb888aa55b40f61e13df 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