ssh - Unable to retrieve data from Checkpoint Firewall using Net::SSH2 Perl module -


i trying ssh checkpoint firewall having gaia os using net::ssh2 module in perl. script able connect , authenticate, unable output device. when try enter expert mode using script, able authenticate, after entering expert mode when try execute command, getting error "invalid command", means script still executes commands in default mode instead of expert mode.

code

use net::ssh2; use strict;  $ssh = net::ssh2->new();  $ssh->connect('xxx.xxx.xxx.xxx');  $ssh->auth(username => 'xxxx', password => 'xxxx');   $channel = $ssh->channel() or { print" [log error]: failed create channel. exiting ...\n"};  $channel->blocking(0);  $channel->shell() ;  $expertpasswd='xxxxx';  $cmd="expert;$expertpasswd;ethtool eth0";  @temp=split(';',$cmd);  sleep(5);  foreach $acmd(@temp) {      print $channel "$acmd\n";      sleep(30);      while(<$channel>){            print $_;     } } 

output

c:\users\spectrum\desktop>perl ssh2_script.pl gw-10aa1a> enter expert password:  warning! configuration should done through clish in expert mode now.  gw-10aa1a> clinfr0329  invalid command:'ethtool eth0'. gw-10aa1a> 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -