#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    68
    Rep Power
    2

    Smile Trying to telnet using perl


    Hi all, i am using the following pattern and trying to access network devices using telnet but it gives me Timeout every time.
    When i try manually i do have access on the devices. Does anyone know what i am doing wrong?

    Thanks

    Code:
    use Net::Telnet;
    $telnet = new Net::Telnet ( Timeout=>10,
    Errmode=>'die');
    $telnet->open('camel.perlfect.com');
    $telnet->waitfor('/login: $/i');
    $telnet->print('bilbo');
    $telnet->waitfor('/password: $/i');
    $telnet->print('baggins');
    $telnet->waitfor('/\$ $/i');
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,875
    Rep Power
    1225
    Have you read the "Debugging" section of the module's documentation?
    Debugging

    The typical usage bug causes a time-out error because you've made incorrect assumptions about what the remote side actually sends. The easiest way to reconcile what the remote side sends with your expectations is to use input_log() or dump_log().

    dump_log() allows you to see the data being sent from the remote side before any translation is done, while input_log() shows you the results after translation. The translation includes converting end of line characters, removing and responding to TELNET protocol commands in the data stream.

IMN logo majestic logo threadwatch logo seochat tools logo