Solved

Net::Telnet prompt issue

Posted on 2004-10-05
3
1,527 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
[X]
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
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

738 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