in reply to Re: Net::Appliance::Session and Console Server
in thread Net::Appliance::Session and Console Server

Thanks for the suggestion, but that actually logs me into the terminal server IP address and not the terminal server + port. If I use wireshark to sniff the packets...Port => 2033 actually works as part of the new constructor. When I attempt to connect I see the traffic sent to 2033. If I use Opts during the connect method I don't see traffic sent to the correct port. I believe Opts is actually for SSH traffic and not Telnet traffic. Not sure where to go from here...
  • Comment on Re^2: Net::Appliance::Session and Console Server

Replies are listed 'Best First'.
Re^3: Net::Appliance::Session and Console Server
by Khen1950fx (Canon) on Mar 08, 2010 at 03:14 UTC
    Try dropping down to a REPL like:
    #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use Net::Appliance::Session; $|=1; my $host = 'cisco_server' if (not defined $host); my $session_obj = Net::Appliance::Session->new( Host => $host, REPL => 1, ); $session_obj->connect( Name => 'user', Password => 'password', );
      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.