Help with custom Telnet Application

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Brown
Date:  
Subject: Help with custom Telnet Application
Jeff Seese wrote:

>
> On Saturday, February 7, 2004, at 10:26 AM, Craig White wrote:
>
>> On Sat, 2004-02-07 at 09:41, Jeff Seese wrote:
>>
>>> Group,
>>> I have been trying for several days to figure out the telnet protocol
>>> with for use in a custome application, but without any luck. Here is a
>>> brief description of what I am trying to do, and what I have tried.
>>>
>>> I am trying to write an application that will run on a sharp Zaurus,
>>> telnet to a local machine, execute some commands and then close the
>>> connection. I am developing this on a Redhat 9 box, in c++ and
>>> xcompiling for the Zaurus.
>>>
>>> I have found a few examples and source of telnet applications that I
>>> can compile and get working for the Redhat platform, but they won't
>>> compile with the arm-linux-g++ compiler.
>>>
>>> I have read lots of RFC's and tried to go back into the code of these
>>> working applications that I have found to figure out what the telnet
>>> protocol is, but I am afraid it's above my head.
>>>
>>> I am able to write an application that does the following.
>>> - open a socket to port 23 on the remote machine from the Zaurus.
>>> - The remote machine reports that a telnet session has started in the
>>> messages log file.
>>> - then I try to send my userID and password, but nothing appears in the
>>> log of the host machine, however I do get some odd looking characters
>>> returned to the Zaurus. (yyp#!ypy##.....) This is where I need help.
>>>
>>> If I could get a simple example of a telnet handshake so I could figure
>>> out what I am supposed to be sending it, and what I should expect that
>>> would be great.
>>>
>>> Unfortunately I can't use Perl and the net::telnet.
>>>
>>> Thanks in advance for any help,
>>> Also, I know this is not exactly the correct list to offer to pay for
>>> help..... But I am
>>> willing to pay for help.
>>
>> ---
>> I haven't done this with telnet but have with other programs such as
>> wget, ftp and such.
>>
>> On your handheld, you can generally create a ~/.telnetrc with the user
>> and password and host and those will automatically be read from the file
>> and passed to your telnet application and provide authentication to the
>> system you are trying to connect to.
>>
>> Recognize that most distro's don't enable telnet server if they even
>> install it and you can see what is being logged - at least on Red Hat
>> systems by looking at /var/log/secure and /var/log/messages. Also, the
>> telnetd server daemon will launch and use settings from xinetd so your
>> it would have to be configured to run, and settings in /etc/hosts.allow
>> and /etc/hosts.deny would apply.
>>
>> On a redhat system, I would probably up2date (yum or apt-get) [install]
>> telnetd
>> then edit /etc/sysconfig/telnetd to state disable=no
>> then restart xinetd (service xinetd restart)
>> and I would be working - insecure but working.
>>
>> obligatory comment - use ssh instead, it's encrypted.
>>
>> Craig
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list -
>> To subscribe, unsubscribe, or to change you mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>>
>
> Thanks for the feed back,
> Telnet is installed and running on my test machine that I am telnetting
> to. I can telnet to it from other machines and watch the log files when
> I connect and disconnect.
>
> When my application is complete and in operation it will be connecting
> to NEXT boxes, not linux (The NeXT machines control a piece of
> manufacturing equipment). I have looked on them and I don't think they
> even have an sshd. The machines are quite old. Telnet is already in use
> on them for remote terminals, which are also running NeXT. The machines
> are not networked together on any type of LAN, so the only access to
> them is physically being in front of them.
>
> I will look into the bash script a bit, however I would rather it's not
> dependent on a script, plus this is for real time display of data from
> the host machine. I don't think the results would be acceptable if I had
> to negotiate the connection every few seconds to retrieve realtime data.
>
> I have tried all kinds of opening a pipe to telnet on the hand held, but
> telnet only accepts input from the terminal not STDIN, so that doesn't
> work.
>
> I read somewhere an individual was trying to open a pipe to a tty, and
> command that to open a telnet session. I don't quite understand if that
> would work. Any ideas on that?


See if you can use Expect or perl on the zaurus. Expect is a wrapper language
for normally interactice processes and makes them non-interactive. Perl has
modules for creating your own telnet application.