Telnet Automation with Pending: Slow Authentication?

I am sending a command to the Mikrotik router using Telnet.

telnet 192.168.100.100 -l admin
Password: pass1234
[admin@ZYMMA] > /interface pppoe-server remove [find user=aspeed13]
[admin@ZYMMA] > quit

It works great.

Now I want to automate it using a wait tcl script:

#!/usr/bin/expect --
spawn telnet 192.168.100.100
expect "Login:"
send "admin\r"
expect "Password:"
send "pass1234\r"
expect "\[admin@ZYMMA\] >"
send "/interface pppoe-server remove \[find user=aspeed13\]\r"
expect "\[admin@ZYMMA\] >"
send "quit\r"

It works, but after authentication (line 6:) send "pass1234\r"when loading the router CLI, it freezes for ~ 10 seconds with the following characters. ^[[?6c^[[24;3R Then the scripts work fine.

My question is, why does Telnet load quickly when accessed manually and it takes too much time to access through expect script? I read in the forums about telnet automation, they say that telnet is slow, but since manually it is too fast, why does it take time to boot with a wait?

+3
source share
4

, , - , . (, - - ).

- - telnet, :

#!/usr/bin/expect --
set env(TERM) dumb
spawn telnet 192.168.100.100
# Rest of your script goes here ...

, VT102 ( ), , interact ( , ). , ?

(NB: dumb , , , . , , ...)

+2

netcat, telnet?

+1

.
.
script autoexpect, "script.exp" , .

:
cd $HOME
autoexpect telnet 192.168.100.100
 # telnet

~/script.exp
Tcl, , ths script tcl.

+1
source

My answer is perhaps too late. This is the "Telnet autoconfig command" ... I had this problem and found this solution in the Mikrotik Wiki:

Add + t after the login. This switch is automatically turned off.

Example: send "admin + t \ r"

This works fine, and not "wait about 10 seconds" after logging in, waiting.

There is a link to Mikrotik WiKi help with a lot of "switches": http://wiki.mikrotik.com/wiki/Manual:Console_login_process#FAQ

PS: Sorry for my English.

+1
source

All Articles