Hi everyone,

I am currently trying to pull the running config from various Cisco devices. I decided I would start with the basics and pull from one device to start with and then alter the script. My issue is that I can't even get that right!

When running the below script it is constantly asking for the password. If I manually provide the same password (when prompted) that is referenced in the script I can see on the switch that it logs in successfully, however the script keeps on prompting for it.

use strict; use warnings; use Net::Appliance::Session; my $ios_device_ip = '10.10.1.1'; my $ios_username = 'redacted'; my $ios_password = 'redacted'; my $running_config_file = "$ENV{HOME}/running_config.txt"; my $session_obj = Net::Appliance::Session->new( host => $ios_device_ip, personality => 'ios', transport => 'SSH', ); # try to login to the ios device, ignoring host check $session_obj->connect( Name => $ios_username, Password => $ios_password, SHKC => 0 ); # get our running config my @running_config = $session_obj->cmd('show running'); # chop out the extra info top and bottom of the config @running_config = @running_config[ 2 .. (@running_config -1)]; open(FH, "> $running_config_file") or die("Cannot open config file : $!"); print FH @running_config; close FH; # close down our session $session_obj->close;

The password does have special characters in it. I have tried using the " quotes round the password but hasn't made any difference.

Could anyone advise on what I should be looking at?

In reply to Issue with Net::Appliance::Session by ThePerlNoob

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.