Page 1 of 1
Telnet
Posted: Fri Aug 29, 2008 2:18 pm
by SA
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.
Re: Telnet
Posted: Fri Aug 29, 2008 4:18 pm
by sergejs
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.
Re: Telnet
Posted: Fri Aug 29, 2008 6:21 pm
by vegard
We've also seen this with 3.x. Try hitting enter (send "\r\n") a few times. It also happens with mac telnet.
Re: Telnet
Posted: Sun Aug 31, 2008 10:14 pm
by SA
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.
Re: Telnet
Posted: Mon Sep 01, 2008 1:15 pm
by janisk
try to provide login parameters in you scripts.
Re: Telnet
Posted: Tue Sep 02, 2008 10:07 am
by SA
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).
Re: Telnet
Posted: Tue Sep 02, 2008 1:04 pm
by normis
Please paste the entire script here, or send it to support, so we can check what is wrong with ROS 3.13
Re: Telnet
Posted: Wed Sep 03, 2008 11:52 am
by SA
#!/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>
Re: Telnet
Posted: Tue Sep 23, 2008 11:01 am
by SA
Doesn't work in 3.14 either
Re: Telnet
Posted: Tue Sep 23, 2008 11:18 am
by mrz
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
Re: Telnet
Posted: Tue Sep 23, 2008 12:04 pm
by Chupaka
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";
Re: Telnet
Posted: Thu Sep 25, 2008 3:43 pm
by SA
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