Cisco Expect Script 72,733 views

An expect script to automatiaclly log into cisco routers.

 1#!/usr/bin/expect 2 3set timeout 5 4set hostname [lindex $argv 0] 5 6set username "username" 7set password "password" 8set enablepassword "password" 910spawn telnet $hostname1112expect "Username:" {13  send "$username\n"14  expect "Password:"15  send "$password\n"1617  expect ">" {18    send "en\n"19    expect "Password:"20    send "$enablepassword\n"21  }2223  interact24}