Where would I be telling Net::Appliance::Session to connect to a specific port?
I tried this:
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use Net::Appliance::Session;
my $ios_device_ip = '10.2.200.10'; # Terminal Server IP
my $ios_username = 'username';
my $ios_password = 'password';
$|=1;
my $session_obj = Net::Appliance::Session->new(
Host => $ios_device_ip,
Transport => 'Telnet',
Port => '2033',
REPL => 1,
Dump_log => 'dump.log',
Input_log => 'input.log',
Output_log => 'output.log'
);
# give verbose output whilst we run this script
$session_obj->input_log(*STDOUT);
eval {
$session_obj->connect(Name => $ios_username, Password => $ios_pas
+sword); # Line 54
$session_obj->cmd('show version');
$session_obj->cmd('show clock');
$session_obj->cmd('help');
};
if ( UNIVERSAL::isa($@,'Net::Appliance::Session::Exception') ) {
print $@->message, "\n"; # fault description from Net::Appliance
+::Session
print $@->errmsg, "\n"; # message from Net::Telnet
print $@->lastline, "\n"; # last line of output from your applian
+ce
# perform any other cleanup as necessary
}
$session_obj->close();
Which resulted in this:
./ssh_connect.pl
Failed to get first prompt at ./ssh_connect.pl line 54
pattern match timed-out
The input.log and output.log contained nothing and the dump log contained Hex. Do I need another module installed? Did I do the REPL wrong? Thanks for your help so far.
|