Query in Net::Telnet Module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kriz4321
    New Member
    • Jan 2007
    • 48

    Query in Net::Telnet Module

    Hi all,

    This is the code I use to login to any device.( I will not be able to see any window but it will be able to login to the device and give the command specified)... can you tell me what changes I should do so that I can see what happens ...(like telnetting to the device ) Hope you can get my question

    [CODE=perl]
    $telnet3 = new Net::Telnet(
    Timeout => 10,
    Errmode => 'die',
    );
    $telnet3->open('192.168. 134.36'); # Substituted fake IP
    $telnet3->waitfor('/Enter login: $/i');
    $telnet3->print('user' ); # Substituted fake User
    $telnet3->waitfor('/Enter password: $/i');
    $telnet3->print('pass' ); # Substituted fake PW
    $telnet3->waitfor('/> $/i');
    print "Logged in to device\n";
    telnet3->print("reboot" );
    [/CODE]
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Hi kriz,

    Sorry, but I've never used Net::Telnet, so I don't advise you in this. I can only point you to the documentation in hope that they specify something:

    cpan Net::Telnet

    However, I will point out that it is generally not a good idea to include the IP, login, and password to your device in a public forum post. I've editted out that information from your post, but just wanted to make sure that you avoided doing that in the future.

    - Miller

    Comment

    Working...