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.