add hardware authentication via expect example

Change-Id: I897b580524fa7bd33fb61538411ae10f453ea9b7
This commit is contained in:
Alexey Elagin 2015-12-18 03:44:07 +03:00
parent ff69508da9
commit 0d67b545b8
1 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,11 @@
set switch_ip [lindex $argv 0]
set switch_pass [lindex $argv 1]
spawn ssh "root@$switch_ip"
set timeout 500
expect "yes/no" {
send "yes\r"
expect "*?assword" { send "$switch_pass\r" }
} "*?assword" { send "$switch_pass\r" }
expect "# " { send "show run" }
expect "# " { send "exit\r" }