I'm telnetting into a router. Apart from the fact I can't seem to
view the output when iniciating the session, I can't match one of the
expressions using Net::Telnet. I can telnet into the router manually
without a problem. I'm running a sniffer at the same time just to see
what's happening behind the scenes. The computer does an ARP request
looking for the router's direction, but that seems to be it. I don't
think any data actually gets passed to iniciate telnet. I'm using the
following code:
1. use Net::Telnet;
2. $telnet = new Net::Telnet ( Timeout=>10,
3. Errmode=>'die');
4. $telnet->open('192.168.0.1');
5. $telnet->waitfor('/login:$/i');
6. $telnet->print('admin');
7. $telnet->waitfor('/Password: $/i');
8. $telnet->print('admin');
9. $telnet->waitfor('/\$ $/i');
10. $telnet->print('?');
11. $output = $telnet->waitfor('/adsl> \$ $/i');
12. print $output;
After logging into the router manually, confirming the
"login/password", I receive the prompt(exactly as it is written,
including spaces:)
login:admin
Password: *****
Login successful
--> (There is a space after the arrow to the right)
Here is the error I'm receiving:
pattern match timed-out at telnet.pl line 9
Should I assume that the script is atleast making it to that point.
I'm referring to the confirmation of the "login/passord". Any help
would be appreciated. Thanks in advance.