[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Got the session, but can't get through the login.

Posted on 2008-11-07
3
Medium Priority
?
183 Views
Last Modified: 2012-05-05
Manual telnet would produce:

User Access Verification

Password:_


When I use the code below, I only get:

User Access Verification

(Can't get to the password prompt.)
#!perl
use warnings;
use strict;
use Net::Telnet;
 
my $Response;
 
my $telnet = Net::Telnet->new();
$telnet->open("172.20.1.254")
  or die "Could not open connection\n";
 
while ($Response = $telnet->getline){
        print $Response;
}

Open in new window

0
Comment
Question by:HilltownHealthCenter
  • 2
3 Comments
 

Author Comment

by:HilltownHealthCenter
ID: 22907037
More: after several seconds, this line appeared:

read timed-out at C:\test_ping.pl line 13

C:\>
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 500 total points
ID: 22907235
The getline function will return the next line, and if one isn't available, it'll wait for one (or until it times out).  A line ends with "\n" (but this can be changed).  Since the password line doesn't have a "\n" on the end, it isn't yet a full line, so the getline function doesn't return it.

It sounds like you might want to use the waitfor function instead of getline:

You might want to read through the Net::Telnet documentation, as there are a lot of features of this module
...
my $telnet = Net::Telnet->new();
$telnet->open("172.20.1.254")
  or die "Could not open connection\n";
$telnet->waitfor('Password');

Open in new window

0
 

Author Closing Comment

by:HilltownHealthCenter
ID: 31514465
Got it to work. Fantastic!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
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…
Six Sigma Control Plans
Suggested Courses

834 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