unixrookie
MIS
I need to write a script to telnet into a router and issue a few commands any ideas. I know there is a telnet module but i'm not to familiar with it's workings? I'm new to perl so i thank you in advance for your help
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
my $t = new Net::Telnet(
Dump_log => 'dump.log',
Input_log => 'input.log',
Output_log => 'output.log',
);
use Net::Telnet;
my $host = "XXX";
my $user = "YYY";
my $password = "ZZZ";
my $prompt = "]#";
my (@data, $line);
my $t = new Net::Telnet(
Timeout => '5',
Prompt => "/$prompt/",
Dump_log => 'dump.log',
Input_log => 'input.log',
Output_log => 'output.log',
);
$t->Net::Telnet::open($host);
$t->login(
Name => $user,
Password => $password,
);
@data = $t->cmd(String => 'uptime');
foreach $line (@data) {
print "$line\n";
}
$t->close();