Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Cannot get enable> mode to work

by ArifS (Beadle)
on Sep 18, 2014 at 16:58 UTC ( [id://1101088]=note: print w/replies, xml ) Need Help??


in reply to Re: Cannot get enable> mode to work
in thread Cannot get enable> mode to work

I am trying to avoid net::telnet::cisco, as it doesn't give all the features, and had much more luck with the net::telnet.

Anything wrong in the following format? -
# authentication if ($telnet->waitfor('/Username: $/i')) { $telnet->print($username); } elsif ($telnet->waitfor('/Password: $/i')) { $telnet->print($password); } # Wait for the prompt, send "enable" and enable-pwd elsif ($telnet->waitfor('/>/')) { $telnet->print('enable'); $telnet->waitfor('/Password: $/i'); $telnet->print($enpwd); } else { $telnet->waitfor('/>/'); $telnet->print('enable'); $telnet->waitfor('/Password: $/i'); $telnet->print($enpwd); }
It doesn't like the format. But individually works just fine.....

Replies are listed 'Best First'.
Re^3: Cannot get enable> mode to work
by VinsWorldcom (Prior) on Sep 18, 2014 at 18:14 UTC

    Net::Telnet::Cisco subclasses Net::Telnet, so everything you have in Net::Telnet is actually available in Net::Telnet::Cisco.

      Thank you for the update. I will try with the ::cisco too.
      However, in the meantime I was able to get it to work-
      $telnet->waitfor('/Username: $/i'); $telnet->print($username); $telnet->waitfor('/Password: $/i'); $telnet->print($password); $telnet->waitfor('/>/'); $telnet->errmode("return"); $telnet->print('enable'); $telnet->errmode("return"); $telnet->waitfor('/Password: $/i'); $telnet->errmode("return"); $telnet->print($enpwd); $telnet->errmode("return");
      Key here is the errmode = return.
      It works for all the scenarios below for Tacacs, console etc-
      1) username, password, enable password
      2) username, password
      3) enable passowrd etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1101088]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-23 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found