473,508 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using cmd.exe as a telnet client

Several months ago I tried using the telnet module (on Windows XP) to
communicate with a proprietary host on our network. This was
unsuccessful due to problems with "option negotiation", and I gave up on
the project for a while. I still have need for this, however, so I
recently started thinking about alternatives. I suppose I could dig deep
enough into option negotiation to use the socket module (with telnet as
a guide), but I am hoping to find a way to use fewer synapses.

Using the Windows C:> prompt (cmd.exe) I can telnet into this host with
no problems (the Windows telnet client performs option negotiation just
fine). Is there a straightforward way of using os.popen() (or os.fork()
or os.exec*() or os.wait*()) to connect to the host from Python via the
Windows telnet client?

Thanks,
Donnal Walter
Arkansas Children's Hospital
Jul 18 '05 #1
6 5212
On 2004-12-03, Donnal Walter <do****@donnal.net> wrote:
Several months ago I tried using the telnet module (on Windows XP) to
communicate with a proprietary host on our network. This was
unsuccessful due to problems with "option negotiation", and I gave up on
the project for a while. I still have need for this, however, so I
recently started thinking about alternatives. I suppose I could dig deep
enough into option negotiation to use the socket module (with telnet as
a guide), but I am hoping to find a way to use fewer synapses.


You don't have to start from scratch. The telnet module has
hooks built-into it1 so that you can have it call your routines
to handle option negotiation. I did it once to impliment some
extra Telnet protocol features, and it wasn't difficult.

--
Grant Edwards grante Yow! How's the wife? Is
at she at home enjoying
visi.com capitalism?
Jul 18 '05 #2
Grant Edwards wrote:
You don't have to start from scratch. The telnet module has
hooks built-into it1 so that you can have it call your routines
to handle option negotiation. I did it once to impliment some
extra Telnet protocol features, and it wasn't difficult.
Ok, you've inspired me to give it a try. First, I am assuming that you
mean writing a custom callback function to send to
Telnet.set_option_negotiation_callback(callback). Or did you mean
writing a subclass of Telnet? Can someone provide an example of a
callback function that I might use as a template for writing mine?

This is unfamiliar territory for me, but I tried to snoop a bit using
ethereal (also new to me) and as near as I can tell, the options in
question are:
0, binary transmission
1, echo
3, suppress go ahead
23, send location

And it may be that not all of these are critical, but if so, I don't
know how to tell which is which.

Eyal Lotem wrote: I think I have a much simpler solution for you guys..
Assuming you can run arbitrary code on the proprietary
server.
Actually I cannot. The server runs a second-party information system,
the primary access to which is third-party terminal emulator software
that uses telnet connections. What I am trying to do is emulate this
emulator. :-)
cmd.exe is not a command line program. It's a terminal (emulator).
You might be able to use the telnet program, though.
Yes, I see that now. Thanks.
Before doing this,
I'd recommend looking at Twisted's telnet support (both
the version in 1.3 and the version that will be in 2.0),
which actually supports option negotiation in a
reasonable way.


I've been wanting to get acquainted with Twisted for awhile now, so this
might be a good time to do so. I think I will give Grant's idea a whirl,
but if I get bogged down there, I will definitely look at Twisted's
telnet support. BTW, do you know if Twisted's option negotiation uses a
callback function? I might download it just to take a look, even if I
don't use it directly.

Thanks,
Donnal Walter
Arkansas Children's Hospital
Jul 18 '05 #3
Grant Edwards wrote:
You don't have to start from scratch. The telnet module has
hooks built-into it1 so that you can have it call your routines
to handle option negotiation. I did it once to impliment some
extra Telnet protocol features, and it wasn't difficult.
Ok, you've inspired me to give it a try. First, I am assuming that you
mean writing a custom callback function to send to
Telnet.set_option_negotiation_callback(callback). Or did you mean
writing a subclass of Telnet? Can someone provide an example of a
callback function that I might use as a template for writing mine?

This is unfamiliar territory for me, but as near as I can tell, the
options in question are:
0, binary transmission
1, echo
3, suppress go ahead
23, send location

And it may be that not all of these are critical, but if so, I don't
know how to tell which is which.

Eyal Lotem wrote: I think I have a much simpler solution for you guys..
Assuming you can run arbitrary code on the proprietary
server.
Actually I cannot. The server runs a second-party information system,
the primary access to which is third-party terminal emulator software
that uses telnet connections. What I am trying to do is emulate this
emulator. :-)

Jp Calderone wrote: cmd.exe is not a command line program. It's a terminal (emulator).
You might be able to use the telnet program, though.
Yes, I see that now. Thanks.
Before doing this,
I'd recommend looking at Twisted's telnet support (both
the version in 1.3 and the version that will be in 2.0),
which actually supports option negotiation in a
reasonable way.


I've been wanting to get acquainted with Twisted for awhile now, so this
might be a good time to do so. I think I will give Grant's idea a whirl,
but if I get bogged down there, I will definitely look at Twisted's
telnet support. BTW, do you know if Twisted's option negotiation uses a
callback function? I might download it just to take a look, even if I
don't use it directly.

Thanks,
Donnal Walter
Arkansas Children's Hospital
Jul 18 '05 #4
Grant Edwards wrote:
You don't have to start from scratch. The telnet module has
hooks built-into it1 so that you can have it call your routines
to handle option negotiation. I did it once to impliment some
extra Telnet protocol features, and it wasn't difficult.
Ok, you've inspired me to give it a try. First, I am assuming that you
mean writing a custom callback function to send to
Telnet.set_option_negotiation_callback(callback). Or did you mean
writing a subclass of Telnet? Can someone provide an example of a
callback function that I might use as a template for writing mine?

This is unfamiliar territory for me, but as I can tell, the options in
question are:
0, binary transmission
1, echo
3, suppress go ahead
23, send location

And it may be that not all of these are critical, but if so, I don't
know how to tell which is which.

Eyal Lotem wrote: I think I have a much simpler solution for you guys..
Assuming you can run arbitrary code on the proprietary
server.
Actually I cannot. The server runs a second-party information system,
the primary access to which is third-party terminal emulator software
that uses telnet connections. What I am trying to do is emulate this
emulator. :-)

Jp Calderone wrote: cmd.exe is not a command line program. It's a terminal (emulator).
You might be able to use the telnet program, though.
Yes, I see that now. Thanks.
Before doing this,
I'd recommend looking at Twisted's telnet support (both
the version in 1.3 and the version that will be in 2.0),
which actually supports option negotiation in a
reasonable way.


I've been wanting to get acquainted with Twisted for awhile now, so this
might be a good time to do so. I think I will give Grant's idea a whirl,
but if I get bogged down there, I will definitely look at Twisted's
telnet support. BTW, do you know if Twisted's option negotiation uses a
callback function? I might download it just to take a look, even if I
don't use it directly.

Thanks,
Donnal Walter
Arkansas Children's Hospital
Jul 18 '05 #5
On 2004-12-06, Donnal Walter <do****@donnal.net> wrote:
Grant Edwards wrote:
You don't have to start from scratch. The telnet module has
hooks built-into it1 so that you can have it call your routines
to handle option negotiation. I did it once to impliment some
extra Telnet protocol features, and it wasn't difficult.
Ok, you've inspired me to give it a try. First, I am assuming
that you mean writing a custom callback function to send to
Telnet.set_option_negotiation_callback(callback).


Yes.
Or did you mean writing a subclass of Telnet?
That depends. If you need to _impliment_ a feature in addition
to doing the negotiation, then you may want to define a
subclass -- though it may easier to just grab the source for
telnetlib and add the feature.
Can someone provide an example of a callback function that I
might use as a template for writing mine?
I've got a negotiation function at home I'll try to remember to
post.
This is unfamiliar territory for me, but as near as I can tell, the
options in question are:
0, binary transmission
1, echo
3, suppress go ahead
23, send location

And it may be that not all of these are critical, but if so, I
don't know how to tell which is which.


That's the tricky part. :)

I guess I'd "enable" negotiation of each of the features one at
a time, and see what happens.

--
Grant Edwards grante Yow! Hey, I LIKE that
at POINT!!
visi.com
Jul 18 '05 #6
I wrote:
I've been wanting to get acquainted with Twisted for awhile
now, ... BTW, do you know if Twisted's option negotiation
uses a callback function? I might download it to take a look, ...


Sorry I did not do this earlier, before I posted. It is obvious (now
that I have downloaded it) that Twisted's Telnet implementation is based
on its own Protocol base class (nice design). The only documentation I
have been able to find, however, is in the protocols/telnet module
itself. It is still not immediately obvious (to me) how to use the iac*
methods to negotiate these options. Any help is much appreciated.

(I've not given up on writing my own funtion for Python's telnetlib, but
I'm trying to keep all my options open. Besides, I will probably have
other uses for Twisted later.)

Donnal Walter
Arkansas Children's Hospital


Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
50242
by: Dan | last post by:
I'm writing a simplistic telnet client in VB6 and I've run into a small snag. The program has a textbox to write in the string to be sent using ..SendData and has another textbox that displays...
4
9284
by: Tim Tyler | last post by:
Has anyone ever built a JavaScript Telnet client? What about a JavaScript SSH client? -- __________ |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
4
5184
by: praba kar | last post by:
Dear All, Normally we can send mail using telnet in linux. In the following way telnet Ipaddress 25 mail from: raj@rajkumar.com 250 o.k(response of from commandline) rcpt to: test@oops.co.in...
4
9863
by: Enos Meroka | last post by:
Hallo, Am trying to establish a telnet session with my C program. However, I seem not to able to get the prompt, after supplying the username and passowrd. could someone assist me in troubleshoot...
1
5839
by: Vasu | last post by:
Hi, I have a requirement to download a file from the web site using a client tool. Iam writing a C# program to download using WebRequest, HttpRequest, WebResponse and so on. The problem...
5
4426
by: | last post by:
Hi all, HttpWebRequest, and SoapHttpClientProtocol both expose a ClientCertificates property, which can hold multiple client certificates, but on the service side, it can only receive one client...
2
5164
by: thilandeneth | last post by:
i need to do telnet via a web server please give me a idia to initiate the project following requirements are needed 1 Create web based custom telnet client to communicate with remote...
0
3834
by: goroth | last post by:
I am trying to create a telnet client that will connect to several of my network devices on campus and change settings on the devices. So far I can connect with the code below, but I can't seem to...
2
2984
by: thamayanthi | last post by:
Hi, The below code is used to connect to the remote machine using Telnet module in perl. use Net::Telnet; use Net::Ping; $telnet = new Net::Telnet (Timeout=>10,Errmode=>'die'); open...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7489
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.