09-28-2010 07:52 AM
I have (and still do) used Kiwi Cat tools to connect but I'd like to bypass this and go directly at the Controller itself via Perl and ssh.
The Perl script looks like it should work but does not return anything. I've tried in both interactive and non interactive modes with the same results... nothing.
Has anyone successfully done this? (Or am I wasting my time trying?)
I'm trying a fairly simple script:
my $host = "aruba-controller";
my $user = "admin";
my $pass = "passwd";
my $ssh = Net::SSH::Perl->new($host, (debug => 1,
protocol => 2 ,
interactive => 0));
my $cmd = "help";
my($stdout,$stderr,$exit) = $ssh->cmd($cmd);
print "stdout=$stdout \nstderr=$stderr \nexit=$exit\n";
10-06-2010 06:17 AM
i havn't done this with perl yet, but form a java-ssh-framework i know that 'command execution' is not working. You have to open a "interactive shell" and handle the session via this shell.
I just had a quick view into the Net::SSH::Perl docu. It seems $ssh->shell might be your friend, but they also noted that they are connecting the output to stdout and input to stdin, what i think is not what you want.
I'm not the perl guru, but it might be a point into the proper direction ;)
11-16-2010 06:01 AM
I never was able to get any of the net::sshX perl modules to work.
What did end up working is a perl expect module. it works a bit odd as far as capturing your output but in the end it works.
11-16-2010 09:21 AM
My SSH implementation had a similar symptoms while i developed but after some time i was able to work out the kinks and get a prompt (i do believe it was a timing issue, hence the sleep() mentioned).