I am trying to interact with Nexus device through Windows via Perl script. These device accept SSH only hence I used Net::SSH2 module.

By using this script it throws nothing for cisco device running IOS-XR or NX-OS but works well for Normal IOS device. .>/p>

PPM Call use warnings; use strict; use Term::ANSIColor qw(:constants); use Term::ANSIColor; use Win32::Console::ANSI; #use Text::CSV; use Net::SSH2; Credential declaration / dynamic directory my $user='xxxx'; ### Use your username chomp $user; my $pass='yyyy'; ### Use your Password chomp $pass; my @current_dir=`cd`; $current_dir[0]=~s/\\/\\\\/g; chomp $current_dir[0]; my $ssh = Net::SSH2->new(); #$ssh->debug(1); if(!$ssh->connect('172.16.23.158')){ print BOLD RED "Failed login\n",RESET; } if(!$ssh->auth_password($user,$pass)){ print "Login NOK\n"; } my $channel = $ssh->channel(); $channel->blocking(0); $channel->shell(); print $channel "term len 0\n"; my @junk; push (@junk,"$_") while <$channel>; foreach (@junk) { print BOLD CYAN "$_\n",RESET; }
After doing debug it prints below lines but I do not know what is this.
libssh2_channel_open_ex(ss->session, pv_channel_typ Net::SSH2::poll: timeout = 250, array[1] - [0] = channel - [0] events 1 - libssh2_poll returned 0 - [0] revents 0 Net::SSH2::poll: timeout = 250, array[1] - [0] = channel - [0] events 1 - libssh2_poll returned 0 - [0] revents 0 Net::SSH2::Channel::DESTROY Net::SSH2::DESTROY object 0x3604f98"
Can anyone help to move forward?

In reply to Perl Net::SSH2 on Window by livenode

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.