We want to use telnet connection to mikrotik to run scripts and read some variables.
By default, MT use ansi terminal and sends some escape-characters to control cursor position.
we use simple telnet client in Java and we have some problems with it - it haven’t cursor and all escape-characters accepted as data.
We try to filter it but there is some bugs like
[ u s e r @ M i k r o T i k ] > [ u s e r @ M i k r o T i k ] >
at start session because MT sends escape-character which sets cursor on first position..
Do MT support simple terminal mode without non-text characters? (like cisco, dlink, telnetd, etc)
server:
IAC DO 24 IAC DO 32 IAC DO 35 IAC DO 39
client:
IAC WONT 24 IAC WONT 32 IAC WONT 35 IAC WONT 39 IAC DO 0 (try to enable binary mode)
server:
IAC WILL 0 IAC WILL 3 IAC DO 1 IAC DO 31 IAC WILL 5 IAC DO 33 (server accept binary mode)
client:
IAC DONT 3 IAC WONT 1 IAC WONT 31 IAC DONT 5 IAC WONT 33
server:
IAC WILL 3 IAC WILL 1
M i k r o T i k v 3 . 2 3
L o g i n :
client:
IAC DONT 3 IAC DONT 1 <login>
server:
P a s s w o r d :
<next we can see terminal data with escape-characters>
try to set terminal type (option 24):
server:
IAC DO 24 IAC DO 32 IAC DO 35 IAC DO 39
client:
IAC WILL 24 IAC WONT 32 IAC WONT 35 IAC WONT 39 IAC DO 0
server:
IAC WILL 0 IAC SB 24 IAC SE
client:
SB 24 IS dumb IAC SE
server:
IAC WILL 3 IAC DO 1 IAC DO 31 IAC WILL 5 IAC DO 33
client:
IAC DONT 3 IAC WONT 1 IAC WONT 31 IAC DONT 5 IAC WONT 33
server:
IAC WILL 3 IAC WILL 1
M i k r o T i k v 3 . 2 3
L o g i n :
client:
IAC DONT 3 IAC DONT 1 <login>
server:
P a s s w o r d :
<next we can see terminal data with escape-characters>
Server accepts options but always send text with escape-characters.
Over SSH connection we can see same data, so It is not problem of protocol - it is problem of terminal.
standart windows telnet client keeps in memory all session data and can set cursor at any position at any time.
it is not good way to store all session data in simple telnet clients (like Java) and all vendors like cisco, dlink, etc (and telnetd too) supports simple terminal which use only plain text and client can read and use only last repy (and not needed to store full session data in memory and emulate cursor).
i wrote it 3 times, why ur not understand idea?
This telnet implementation works without problems with all equipment and only MT wants to write prompt twice - first write it, next set cursor to first position of line and write promt again. Why? So it is needed to write unique algorithms to find last command promt especially for MT..
billing have a standart tools to control NAS and gateways over telnet and ssh.
and there is no need to know on which hardware NAS or gateway works - cisco, dlink, or pc with freebsd or MT.
it have some high-level features like active-users monitoring over this protocol.
using api making billing dependent of used NAS and gateways. (or need add support for all api’s)
it was a problems when used MT in this system because it sends escape-characters.