Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Net::Telnet prompt issue

Posted on 2004-10-05
3
Medium Priority
?
1,530 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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans

971 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