Community discussions

MikroTik App
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Telnet. How to work with simple terminal?

Fri Aug 07, 2009 1:03 pm

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)

and how to switch to it?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 3:02 pm

try use 'username+ct' instead of 'username'
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 3:52 pm

i used +ct login but it not solves problem fully. (only disable colors)

so presents double promt at start and some additional escape-characters in even promt.

:put $Variable command reply (by sniffer):
\r\000
false\r\n
\r\000
\r\000
\r\000
\033[9999B[rionet@MikroTik] >
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 3:57 pm

That is how telnet works.
http://www.faqs.org/rfcs/rfc854.html
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 4:06 pm

omg, telnet is a transport layer for the terminal data!

it will send any character (include 0) to another side except 255 (it is start of telnet commands).

i am ask about supporting simple terminal which not use escape-characters!
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 4:28 pm

You can switch to binary mode.
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 4:34 pm

how i can switch terminal to binary mode?
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Fri Aug 07, 2009 4:41 pm

2 Chupaka:
the story of problem in ru language - http://www.bgbilling.ru/forum/viewtopic ... 12f2c5be65
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Mon Aug 10, 2009 12:20 pm

Binary mode not solve problem:
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.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Telnet. How to work with simple terminal?

Mon Aug 10, 2009 12:46 pm

run standart Windows 'telnet' to the RouterOS. if it displays normally - it's not a problem of terminal, it's problem of your Telnet implementation...

p.s. have never experienced any difficulties while working with RouterOS via terminal. anyway, API rulezzz ))
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Mon Aug 10, 2009 3:28 pm

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..
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Wed Aug 12, 2009 1:04 pm

there no answers from developers.
so i think that MT is not support simple terminal type.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Telnet. How to work with simple terminal?

Wed Aug 12, 2009 1:16 pm

there no answers from developers.
developers do not visit that forum =) it's Community Forum

and why not simply use API?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Telnet. How to work with simple terminal?

Wed Aug 12, 2009 1:41 pm

options admin+cte will disable colors, terminal detection and enable dumb mode. However carriage returns will still be used.

As Chupaka tried to say several times - API rulezzz.
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Wed Aug 12, 2009 2:55 pm

mrz, thx )

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.

so only way is try to use filter.
 
Reanimatorr
newbie
Topic Author
Posts: 33
Joined: Wed Apr 01, 2009 2:21 am

Re: Telnet. How to work with simple terminal?

Wed Aug 12, 2009 3:06 pm

mrz, can you post all supported login suffixes like +ct or +cte with description?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Telnet. How to work with simple terminal?

Wed Aug 12, 2009 3:12 pm

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], GoogleOther [Bot] and 100 guests