Thanks a lot Kristian, Net::SSH::Perl was the one I was thinking about.

On Mon, Sep 12, 2011 at 2:41 PM, Kristian Hoffmann <[email protected]> wrote:
> On 09/12/2011 09:50 AM, Alan Bryant wrote:
>>
>> Does anyone have anything already, or prefer a specific SSH module
>> over the others?
>>
>
> Quick 'n dirty...
>
> #!/usr/bin/perl
>
> use Net::SSH::Perl;
>
> my $host = '10.0.0.1';
> my $user = 'admin';
> my $pass = 'pass';
> my $cmd = '/system resource print';
>
> my $ssh = new Net::SSH::Perl($host);
> $ssh->login($user, $pass);
>
> my ($stdout, $stderr, $exit) = $ssh->cmd($cmd);
>
> print "stdout: $stdout\n";
> print "stderr: $stderr\n";
> print "exit: $exit\n";
>
>
> FYI, Net::SSH::Perl supports RSA authentication and works with RouterOS.
>  You'll also probably want to wrap the login and cmd calls in an eval block
> and trap authentication or other spurious errors if this is for something
> non-interactive.
>
> Regards,
>
> --
> Kristian Hoffmann
> System Administrator
> [email protected]
> http://www.fire2wire.com
>
> Office - 209-543-1800 | Fax - 209-545-1469 | Toll Free - 800-905-FIRE
>
> _______________________________________________
> Mikrotik mailing list
> [email protected]
> http://www.butchevans.com/mailman/listinfo/mikrotik
>
> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS
>



-- 
Alan Bryant
Gtek Computers & Wireless L.L.C.
Office: 361-777-1400 | Fax: 361-777-1405
[email protected] | www.gtek.biz

CONFIDENTIALITY NOTICE: This communication (including any attachments)
may contain privileged or confidential information intended for a
specific individual and purpose, and is protected by law. If you are
not the intended recipient, you should delete this communication
and/or shred the materials and any attachments and are hereby notified
that any disclosure, copying, or distribution of this communication,
or the taking of any action based on it, is strictly prohibited. Thank
you.
_______________________________________________
Mikrotik mailing list
[email protected]
http://www.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

Reply via email to