jtzako has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to convert a script that was using Net::Telnet to now use Net::SSH2 but there are some differences in the commands that I'd like some advice on.
Here is an example that I have from the script. The first thing that doesnt work is "print" but there may be more.In this case $t is the Net::SSH2 connection. Can I reuse my code in a reasonable way or do I need to significantly redo this?$t->connect($jump_host); $t->auth_keyboard($jump_user, $jump_pass); $t->print("telnet $host"); } else { (undef, $host) = split /\s+/, $opte; $type = 'opte'; $t->open($host); } $t->waitfor('/:/'); $t->print($z{$type}{'user'}); $t->waitfor('/:/'); $t->cmd($z{$type}{'pass'}); $t->print('enable'); $t->waitfor('/:/'); $t->cmd($z{$type}{'sudo'}); $t->cmd('terminal length 0'); $t->cmd('terminal width 512'); $t->prompt('/[\$#] *$/');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing a script from Net::Telnet to Net::SSH2
by perlfan (Parson) on Mar 03, 2016 at 21:08 UTC | |
by jtzako (Sexton) on Mar 03, 2016 at 21:14 UTC | |
by dasgar (Priest) on Mar 03, 2016 at 21:38 UTC | |
by jtzako (Sexton) on Mar 03, 2016 at 22:18 UTC | |
by dasgar (Priest) on Mar 03, 2016 at 23:31 UTC | |
|
Re: Changing a script from Net::Telnet to Net::SSH2
by dasgar (Priest) on Mar 03, 2016 at 19:30 UTC | |
|
Re: Changing a script from Net::Telnet to Net::SSH2
by salva (Canon) on Mar 04, 2016 at 07:14 UTC | |
by jtzako (Sexton) on Mar 04, 2016 at 17:43 UTC | |
by salva (Canon) on Mar 04, 2016 at 17:50 UTC |