Automate Telnet Login to CISCO Device with Expect

Step 1: Install expect (Centos 6.7 32bit)
yum install expect

Step 2: Verify expect install correct
expect –v

Step 3: Create Working Folder for Script
cd $HOME
mkdir CiscoAutomation
cd CiscoAutomation

Step 4: Create expect script with vi
vi TestCISCOLogin.exp

รจScript file contents
set timeout 10
set hostname [lindex $argv 0]

set username "username"
set password "password"
set enablepassword "password"

spawn telnet $hostname

expect "Username:" {
  send "$username\n"
  expect "Password:"
  send "$password\n"

  expect ">" {
    send "en\n"
    expect "Password:"
    send "$enablepassword\n"



Popular posts from this blog

ActiveMQ, easy to use open source message oriented middleware (MOM)

Basic Send Message to MQ with Java and IBM MQ JMS

Apache Apollo