Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Net::Telnet prompt issue

Posted on 2004-10-05
3
1,525 Views
Last Modified: 2012-06-27
Hi Experts,

I have a perl script that is using Net::Telnet and it gets as far as teh login prompt.

the session is a specific interface and retruns the following promtps when I telent from any host.

Enter User Name:
Enter User Password:

it my current script, it opens the socket and times out waiting for the proper login prompt.

how can i set my prompt to make this work.

here is a snipit of my code:

 use Net::Telnet ();
   my $username = "fred";
   my $passwd = "flintstone";
   my $ip = 10.1.1.1;
   my $t = new Net::Telnet(Prompt => '/Enter User Name:/ ');
    $t->open($ip);
    $t->login($username, $passwd);

any help here is greatly appreciated.

Thanks

Rootman 103
0
Comment
Question by:rootman103
  • 2
3 Comments
 

Accepted Solution

by:
nanoterabeta earned 125 total points
ID: 12233423
In most cases, you don't have to use Prompt, just simple like:
  $telnet = new Net::Telnet ( Timeout=>15,
                              Errmode=>'die',
                             Port => 23
            );
$telnet->open($ip);
$telnet->print($username);
$telnet->print($passwd);
because the user prompt and password prompt will be sent by the host to you successively right after you make a new telnet to the hosts.
Good luck.
0
 

Author Comment

by:rootman103
ID: 12233561
awesome, this worked.

now all i need to do is get it ot print my end results.


Thanks,

Rootman 103
0
 

Author Comment

by:rootman103
ID: 12255110
sorry for the delay in giving you the points.

Thanks again.

Rootman103
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question