in reply to Re: Passing telnet commands through SSH
in thread Passing telnet commands through SSH
but code is always stop on this line: or die "login failed: " . $telnet->lastline; i get the following output:login failed: at test.pl line 21. Could you please help me to successfully achieve connection to telnet host. Thank you.my $ssh = Net::OpenSSH->new('user@1.1.1.2'); my ($socket, $pid) = $ssh->open_tunnel('1.2.0.1', 23); my $telnet = Net::Telnet->new(-fhopen => $socket, -prompt => '/.*\$ $/', -telnetmode => 0, -cmd_remove_mode => 0, -output_record_separator => "\r"); $telnet->waitfor(-match => '/login\ name\:/', -errmode => "return") or die "login failed: " . $telnet->lastline; my @lines = $telnet->cmd("who"); print Dumper(@lines); $telnet->close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Passing telnet commands through SSH
by Corion (Patriarch) on Jul 14, 2014 at 08:28 UTC | |
|
Re^3: Passing telnet commands through SSH
by wrongt (Initiate) on Jul 14, 2014 at 11:15 UTC | |
by salva (Canon) on Jul 15, 2014 at 15:08 UTC |