Hello,
I have been trying to write a script, for days now, that will telnet into a text based antenna unit, enter numeric commands, and then grep the results into a log file or spit them out on the screen.
I'll explain how the antenna unit works. If you were going to access it, this is exactly whatyou would type:
1. telnet 10.5.0.14 (enter)
2. 3 (which automatically brings a prompt up for password, option 3 is for admin)
3. test (enter. test is the password)
4. 1 (the option for unit info)
5. 1 (the option to display the mac address)
Here is the script that I have. I know for sure thats it's logging into the antenna unit, and also hitting option 1, option1, because thats the screen I see on the unit when perl scripts run.
I am sure that the error is in the grep section.
#!/usr/bin/perl
use Net::Telnet::Cisco;
use Net::Telnet;
$router = "10.5.0.14";
my $session = Net::Telnet->new(Host => $router);
$session->print("3test");
@broadcast = $session->print("11");
open LOG, "> log.txt";
select LOG;
print @broadcast;
close LOG;
$session->close;
I have been trying to write a script, for days now, that will telnet into a text based antenna unit, enter numeric commands, and then grep the results into a log file or spit them out on the screen.
I'll explain how the antenna unit works. If you were going to access it, this is exactly whatyou would type:
1. telnet 10.5.0.14 (enter)
2. 3 (which automatically brings a prompt up for password, option 3 is for admin)
3. test (enter. test is the password)
4. 1 (the option for unit info)
5. 1 (the option to display the mac address)
Here is the script that I have. I know for sure thats it's logging into the antenna unit, and also hitting option 1, option1, because thats the screen I see on the unit when perl scripts run.
I am sure that the error is in the grep section.
#!/usr/bin/perl
use Net::Telnet::Cisco;
use Net::Telnet;
$router = "10.5.0.14";
my $session = Net::Telnet->new(Host => $router);
$session->print("3test");
@broadcast = $session->print("11");
open LOG, "> log.txt";
select LOG;
print @broadcast;
close LOG;
$session->close;