Net::Telnet::Cisco->enable always return 1

B

Bhaskar Kurapati

Hi,

I am using Net::Telnet::Cisco module to add some rules in CMTS(Cisco
Router) ... when I am entering enable mode ...
"$session->enable("enable_password")" (see code below) always returns
"1" even when password is wrong. According to Net::Telnet::Cisco
module documentation it should return "1" on success and undefined
when password is wrong or can not enter enable mode.

use Net::Telnet::Cisco;

my($session, $ok, @output);

$session = Net::Telnet::Cisco->new(Host => '123.123.123.123');
$session->login('login', 'password');

# Enable mode
$ok = $session->enable("xxxxxxx");
print "$ok"; # This line always pring "1" even when enable password
is wrong

if ($ok) {
@output = $session->cmd('show privilege');
print "My privileges: @output\n";
} else {
# this loop is never executed even when enable password is wrong
warn "Can't enable: " . $session->errmsg;
}

$session->close;

What might be the problem here ???

thanks in advance
Bhaskar Kurapati
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top