Solved

a telnet client program ie. how to telnet into a remote (linux ) server using socket at port 23?

Posted on 2001-09-07
6
546 Views
Last Modified: 2006-11-17
I have written a client code which uses socket to connect to port 23 in a remote linux server. But the characters returned by the server are junk.

Whenever anyone telnets into a unix server, he may get the foll. display:

dssuresh@venus:> telnet 160.1.1.30
Trying 160.1.1.30...
Connected to 160.1.1.30.
Escape character is '^]'.

HP-UX hprclass B.11.00 U 9000/800 (t2)

login:


Now, if the user enters login id, then password prompt appears, and if it matches, he is allowed login into the server.

Now my client program should be able to read the above characters and display the login prompt and allow the user to enter and the entered login id should be sent to the server which will reply back with the passwd prompt. In effect, I would like to write a client program which allows a user to remote login into a machine(at port 23).

A general client program trying to connect to remote server at port 23 only returns junk characters. How to solve this problem? Any code?

0
Comment
Question by:dssuresh
6 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6464971
I do not understand you real problem, which client does get "junk characters"? Could you give a example?

The wrapper you want to write still exists: expect
which is a Tcl extension, see http://scriptics.com/
0
 
LVL 5

Assisted Solution

by:bryanh
bryanh earned 100 total points
ID: 6468992
I think I understand.  Your program connects to Port 23 of some remote system, and upon accepting the connection, the remote system sends characters that you consider junk.

I'm going to guess that you consider them junk because they aren't the text that 'telnet' displays ("HP-UX hprclass...").

Have you read the telnet protocol?  A telnet server and telnet client speak a binary protocol to each other.  In the middle of a session, they're sending nothing but characters that the user is typing or to be displayed to the user, but at the beginning of a session, there is a conversation between the telnet client and telnet server to establish the parameters of the session.

You can find the Telnet protocol in a TCP/IP book, or find the RFC (I don't have the RFC number offhand, but I could find it), or just study the source code of a 'telnet' program.

0
 
LVL 4

Expert Comment

by:kiffney
ID: 6501602
If you just want to automate a telnet login and get some data, you could sidestep all this by scripting telnet.  Look for 'expect', which is built upon tcl.  If you write an expect script, you can make telnet do what you like - log in, get data, whatever.  There is an O'Reilly book on Expect that's very good - written by Expect's author.  
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9916244
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: ahoffmann {http:#6464971} & bryanh {http:#6468992}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0
 
LVL 4

Expert Comment

by:kiffney
ID: 9916972
sounds fine to me - I didn't see that ahoffman had mentioned 'expect' which is probably what dssuresh needed lo, these many moons ago.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
idM Identity Management in Red Hat 6 - setting up 9 263
centOS 7 GUI is now showing. 20 1,140
Openwrt vnstat 9 151
Use Powershell script to ftp 10 79
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
A short film showing how OnPage and Connectwise integration works.

947 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

20 Experts available now in Live!

Get 1:1 Help Now