Hi,
The below script works fine for me but with normal login, Actually i need to go with "enable 5" and with password "xxxx" to get the user details. So please any one help is here highly appreciated.
Here is my prompt for enable, Pleaes have look on it,
ERX02>enable 5
Password: **********
ERX02#
#!/usr/bin/perl
use Net::Telnet::Cisco;
#$rtrip = 'xx.xx.xx.xxx';
#$pass='support123';
sub juniperlogin
{
$rtrip = $_[0];
print "Logging into router $rtrip\n";
$session = Net::Telnet::Cisco->new(Host => $rtrip, Timeout => '30');
$session->login(Name => 'login', Password => 'support123', Prompt => '/ERX02>$/', Timeout => '30');
#$session->cmd(String => "set cli screen-length 0", Prompt => '/(?m:^\w+@[\w.-]+[>])/', Timeout => '30');
}
sub junipercmd
{
$cmd = $_[0];
#@output = $session->cmd(String => "$cmd", Prompt => '/(?m:^\w+@[\w.-]+[>])/', Timeout => '60');
@output = $session->cmd(String => "$cmd", Prompt => '/ERX02>$/', Timeout => '60');
return @output;
}
&juniperlogin("1.1.7.1");
@output =&junipercmd("show version");
print @output;