Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^3: Problems with Net::OpenSSH

by salva (Abbot)
on Nov 23, 2010 at 17:46 UTC ( #873269=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Problems with Net::OpenSSH
in thread Problems with Net::OpenSSH

But your router seems to support commands from SSH without dropping you to the shell. You probably don't need to use Expect at all:

#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; $| = 1; my $username = ''; my $password = ''; my $enable = ''; my $ip = ''; my $ssh = Net::OpenSSH->new("$username:$password\@$ip", timeout => 30) +; $ssh->error and die "unable to connect to remote host: ". $ssh->error; my $out = $ssh->pipe_out("show ip arp") or die "unable to run remote command show ip arp"; while(<$out>) { print "$. $_" }

Comment on Re^3: Problems with Net::OpenSSH
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2015-11-26 01:19 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (695 votes), past polls