Solved

Net::Telnet prompt issue

Posted on 2004-10-05
3
1,521 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now