here is a sample of teh code I am using to test getting into the switch.
#!/usr/local/bin/perl -w
use Net::Telnet::Cisco;
use strict;
my $debug = 1;
my $IP_Addr = "";
my $switchPassword = "";
my $routerPassword = "";
my $routerEnPassword = "";
my $switchEnPassword = "";
## Get the IP Address
if ($IP_Addr eq "") {
print "Enter the IP Address: ";
chop($IP_Addr = <STDIN>);
system("stty echo");
print "\n";
}
## Get the switchPassword (make it invisible when entering)
if ($switchPassword eq "") {
print "Enter the switch password: ";
system("stty -echo");
chop($switchPassword = <STDIN>);
system("stty echo");
print "\n";
}
print "\tConnecting to $IP_Addr\n" if ($debug);
my $cs = Net::Telnet::Cisco->new(Host => $IP_Addr);
my $ok = $cs->login('login', $switchPassword) or die "Error lo
+gging in: @{[ $cs->errmsg() ]}\n";
print "Logged into Switch\n" if ($debug);
#Turn off paging
my @cmd_output = $cs->cmd( 'terminal length 0' );
#Enter enable mode
if ($switchEnPassword eq "") {
print "Enter the enable password for the switch: ";
system("stty -echo");
chop($switchEnPassword = <STDIN>);
system("stty echo");
print "\n";
}
$ok = $cs->cmd("enable\n$switchEnPassword");
print "entered enable mode\n";
#$i = 0;
#$total = 0;
my @portInfo = $cs->cmd("sho port status ");
print "Here";
my $arrayElement;
foreach $arrayElement (@portInfo) {
print "$arrayElement\n";
} ## end foreach()
$ok = $cs->disable;
$ok = $cs->cmd("session 15\n$routerPassword");
$ok = $cs->cmd("enable\n$routerEnPassword");
my @intStuff = $cs->cmd("dir");
foreach $arrayElement (@portInfo) {
print "$arrayElement\n";
} ## end foreach()
exit;
The only difference I see between teh prompts of the router, and the prompts of the switch is that with the router prompts "Password:" and the switch prompts "Enter password:" |