| |||||||||||
expect script aborting in the middle. Posted by manicisco (manicisco), 14 July 2007 Folks,I am running the below expect script on my windows XP laptop with Active tcl 8.4.14.0.It telnets to the router and logs in using the username and password.But it exits immediately without doing anything more. Script **** package require Expect set timeout 60 set username ww set password ww set target 172.21.55.140 spawn telnet $target expect "name" exp_send "$username\r" expect "word" exp_send "$password\r" expect "DCN" exp_send "show ip route\r" Script Execution ************** User Access Verification Username: ww Password: DCN-CAT-10> C:\Tcl> Basically I am expecting the script to run the "Show ip route" command after authentication. Posted by admin (Graham Ellis), 15 July 2007 I think you're "send"ing before the incoming string has completed. Rather than expect "word", try doing expect "word: " - otherwise you'll start sending the password before the telnet daemon is ready for it, loose the first few characters, resulting in an incorrect password being received and a host that won't let you log in.P.S. You should do the same thing for the user name, though that may not be critical as you have type ahead buffering - but type ahead buffering rarely works with passwords. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
| Course Booking Other Forum Posts Follow us on ... | ||||||||||
+44 PH: (0) 1225 708 225 • FAX: (0) 1225 707 126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |