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;