Community discussions

MikroTik App
 
SA
just joined
Topic Author
Posts: 21
Joined: Wed Jul 28, 2004 12:03 am

Telnet

Fri Aug 29, 2008 2:18 pm

After upgrading to 3.13 from 3.10 my Net::Telnet perl scripts don't work anymore.
Seems like telnet server was changed, but I can't find anything about it in the changelog.
2.9 also works fine.
The ploblem is apparently with terminal type handling, 2.9 says "terminal type is network", 3.13 just hangs after the MikroTik banner.
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Telnet

Fri Aug 29, 2008 4:18 pm

Scripting/console is changed between 2.9 and 3.0, but there should not be too much difference between 3.10 and 3.13 console functions.
 
User avatar
vegard
just joined
Posts: 24
Joined: Sat Feb 12, 2005 6:55 pm

Re: Telnet

Fri Aug 29, 2008 6:21 pm

We've also seen this with 3.x. Try hitting enter (send "\r\n") a few times. It also happens with mac telnet.
 
SA
just joined
Topic Author
Posts: 21
Joined: Wed Jul 28, 2004 12:03 am

Re: Telnet

Sun Aug 31, 2008 10:14 pm

There is nothing to "hit", the problem is with perl scripts (which worked fine with 2.9 and even with older 3.x versions).
Yes, there should not be too much difference, but seems like there is :(

Once again, the script does not receive command prompt, MT telnet server just hangs after login banner.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Telnet

Mon Sep 01, 2008 1:15 pm

try to provide login parameters in you scripts.
 
SA
just joined
Topic Author
Posts: 21
Joined: Wed Jul 28, 2004 12:03 am

Re: Telnet

Tue Sep 02, 2008 10:07 am

Seems like nobody really reads my message :(
The script that works with 2.9 and 3.10 does NOT work with 3.13 due to some change in the console code.
It hangs after login (there is a "logged in via telnet" message in the /log).
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26322
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Telnet

Tue Sep 02, 2008 1:04 pm

Please paste the entire script here, or send it to support, so we can check what is wrong with ROS 3.13
 
SA
just joined
Topic Author
Posts: 21
Joined: Wed Jul 28, 2004 12:03 am

Re: Telnet

Wed Sep 03, 2008 11:52 am

#!/usr/bin/perl

use strict;
use Net::Telnet;

unless (@ARGV > 2) { exit 2; }

my $nasip = shift(@ARGV);
my $community = shift(@ARGV);
my $login = shift(@ARGV);

my ($user,$pass,$t);
($user,$pass)=split(/:/,$community,2);

$t = new Net::Telnet (Timeout => 5,
                      Errmode => "return",
#                     Dump_Log => '/tmp/telnet.log',
                     Prompt => '/> $/');
if ($t->errmsg){
    exit 24;
}
$t->open($nasip);
if ($t->errmsg){
    exit 24;
}
$t->login($user, $pass);
if ($t->errmsg){
    exit 24; #returns here with timeout in 3.13
}
$t->cmd("/interface pppoe-server");
$t->cmd("remove [find user=\"$login\"]");
$t->cmd("/quit");
$t->close();
exit 0;
Here it is. The script is used to disconnect pppoe users
usage: disconnect.pl <mt ip> <mt username>:<mt password> <pppoe username>
 
SA
just joined
Topic Author
Posts: 21
Joined: Wed Jul 28, 2004 12:03 am

Re: Telnet

Tue Sep 23, 2008 11:01 am

Doesn't work in 3.14 either
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Telnet

Tue Sep 23, 2008 11:18 am

try to provide login parameters in you scripts.
Have you tried it?

None of these scripts will work unless console colors and terminal detection is disabled
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Telnet

Tue Sep 23, 2008 12:04 pm

yesss, exactly =)
What's new in 3.0rc14:

*) console - added login parameters, passed as part of login name, after '+';
can be used to disable colors (+c) and terminal autodetection (+t), e.g.
"admin+ct";
 
SA
just joined
Topic Author
Posts: 21
Joined: Wed Jul 28, 2004 12:03 am

Re: Telnet

Thu Sep 25, 2008 3:43 pm

Yes, it works with +ct, but the script must work with both 2.9 and 3.x. (and worked before 3.13).
Anyway, this is sort of a solution, thanks :D

Who is online

Users browsing this forum: Ahrefs [Bot], sgiglio, straightslant, truefriendcz and 92 guests