how to telnet to a switch that without a username prompt?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sayabaobao
    New Member
    • Mar 2008
    • 1

    how to telnet to a switch that without a username prompt?

    Hello all,
    I am using perl net::telnet to login remote switches by
    $t->open($device );
    $t->login($usernam e, $password);
    and everything goes on very well.

    The problem is that now I have to telnet another switch that doesn't have a username prompt...which means only $password is needed when login...
    but so far as i know that both username and pw are parameters of Telnet.pm login()....How can I login such kind of switch?

    Thanks a lot!
  • nithinpes
    Recognized Expert Contributor
    • Dec 2007
    • 410

    #2
    Originally posted by sayabaobao
    Hello all,
    I am using perl net::telnet to login remote switches by
    $t->open($device );
    $t->login($usernam e, $password);
    and everything goes on very well.

    The problem is that now I have to telnet another switch that doesn't have a username prompt...which means only $password is needed when login...
    but so far as i know that both username and pw are parameters of Telnet.pm login()....How can I login such kind of switch?

    Thanks a lot!
    You can avoid using login(). Try using waitfor() method to wait for the prompt and print the password:

    Code:
    $t->open($device);
    $t->waitfor('/password: $/i');
    $t->print($password);
    ##
    $t->print('y');

    Comment

    Working...