473,789 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Telnetlib & Term Types

Greetings

I'd like to do some tweaks on a telnet session as I have no control over
the server side what so ever.

However I cannot correctly negotiate a telnet connection to the server.

I've gone back to basics on the code for simplicity here;

Linux 2.6 : Python 2.3.4
Telnetlib Module - http://www.python.org/doc/2.3.4/lib/...telnetlib.html

import sys, telnetlib
tn = telnetlib.Telne t("xxx.xxx.xxx. xxx")
tn.mt_interact( )

All goes well if I point this code to telnet to 127.0.0.1 (Login etc)

However if I point the code to telnet to the server I get;
Debian GNU/Linux 3.0 xxx.xxx.org
Error opening terminal: network.
Note - telnet from the console to this address works fine.

I have limited knowledge of telnet/terminals however I am beginning to
think that the "server" is trying to negotiate a terminal type
(vt100/vt220 I think) and telnetlib responds incorrectly/not at all.

Any thoughts would be much appreciated / is there a more suitable library
than telnetlib for my purpose?

Many thanks ..... Svha
Jul 18 '05 #1
3 4983
My bad - omitted the set_debuglevel( ) output from the above post ...
Hey it was a Friday afternoon ;)
tn = telnetlib.Telne t(xxx.xxx.org)
tn.set_debuglev el(10)
tn.mt_interact( )
Telnet(xxx.xxx. org,23): recv "\xff\xfd\x18\x ff\xfd \xff\xfd#\xff\x fd'"
Telnet(xxx.xxx. org,23): IAC DO 24
Telnet(xxx.xxx. org,23): IAC DO 32
Telnet(xxx.xxx. org,23): IAC DO 35
Telnet(xxx.xxx. org,23): IAC DO 39
Telnet(xxx.xxx. org,23): recv '\xff\xfb\x03\x ff\xfd\x01\xff\ xfd\x1f\xff\xfb \
x05\xff\xfd!'
Telnet(xxx.xxx. org,23): IAC WILL 3
Telnet(xxx.xxx. org,23): IAC DO 1
Telnet(xxx.xxx. org,23): IAC DO 31
Telnet(xxx.xxx. org,23): IAC WILL 5
Telnet(xxx.xxx. org,23): IAC DO 33
Telnet(xxx.xxx. org,23): recv '\xff\xfb\x03'
Telnet(xxx.xxx. org,23): IAC WILL 3
Telnet(xxx.xxx. org,23): recv '\xff\xfb\x01'
Telnet(xxx.xxx. org,23): IAC WILL 1
Telnet(xxx.xxx. org,23): recv 'Debian GNU/Linux 3.0 x.x.org\r\nErro r opening'
Debian GNU/Linux 3.0 xxx.xxx.org
Error openingTelnet(x xx.xxx.org,23): recv ' terminal: network.\r\n'
terminal: network.

Svha
On Fri, 19 Nov 2004 20:22:27 +0000, Svha wrote:
Greetings

I'd like to do some tweaks on a telnet session as I have no control over
the server side what so ever.

However I cannot correctly negotiate a telnet connection to the server.

I've gone back to basics on the code for simplicity here;

Linux 2.6 : Python 2.3.4
Telnetlib Module - http://www.python.org/doc/2.3.4/lib/...telnetlib.html

import sys, telnetlib
tn = telnetlib.Telne t("xxx.xxx.xxx. xxx")
tn.mt_interact( )

All goes well if I point this code to telnet to 127.0.0.1 (Login etc)

However if I point the code to telnet to the server I get;
Debian GNU/Linux 3.0 xxx.xxx.org
Error opening terminal: network.
Note - telnet from the console to this address works fine.

I have limited knowledge of telnet/terminals however I am beginning to
think that the "server" is trying to negotiate a terminal type
(vt100/vt220 I think) and telnetlib responds incorrectly/not at all.

Any thoughts would be much appreciated / is there a more suitable library
than telnetlib for my purpose?

Many thanks ..... Svha


Jul 18 '05 #2
Svha <ne**@svha.demo n.co.uk> writes:
Greetings I'd like to do some tweaks on a telnet session as I have no control over
the server side what so ever. However I cannot correctly negotiate a telnet connection to the server. I've gone back to basics on the code for simplicity here; Linux 2.6 : Python 2.3.4
Telnetlib Module - http://www.python.org/doc/2.3.4/lib/...telnetlib.html import sys, telnetlib
tn = telnetlib.Telne t("xxx.xxx.xxx. xxx")
tn.mt_interact () All goes well if I point this code to telnet to 127.0.0.1 (Login etc) However if I point the code to telnet to the server I get;
Debian GNU/Linux 3.0 xxx.xxx.org
Error opening terminal: network.
Note - telnet from the console to this address works fine. I have limited knowledge of telnet/terminals however I am beginning to
think that the "server" is trying to negotiate a terminal type
(vt100/vt220 I think) and telnetlib responds incorrectly/not at all. Any thoughts would be much appreciated / is there a more suitable library
than telnetlib for my purpose?


telnetlib support for this is minimal. Basically, you'll need to implement
the negotiation yourself using the option_callback () method. Look at
http://www.faqs.org/rfcs/rfc1091.html for the gory details on what's expected.
The negotiation could get quite complex in principle. One of the other
options it's asking about is for X-server, you may have to deal with that
too.

I've done a small amount of work in this area so I may be able to help, if you
get stuck send me mail.

Eddie
Jul 18 '05 #3
Svha <ne**@svha.demo n.co.uk> wrote:
My bad - omitted the set_debuglevel( ) output from the above post ...
Hey it was a Friday afternoon ;)

tn = telnetlib.Telne t(xxx.xxx.org)
tn.set_debuglev el(10)
tn.mt_interact( )

Telnet(xxx.xxx. org,23): recv "\xff\xfd\x18\x ff\xfd \xff\xfd#\xff\x fd'"


This is documented in RFC 854, 930, 990, etc,
e.g., www.faqs.org/rfcs/rfc854.html

(google "telnet options")

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Jul 18 '05 #4

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

Similar topics

2
4808
by: walala | last post by:
Dear all, I recently came across a Python program which used "telnetlib" to automate things in the several unix machines in our local networks; I attached the script as follows; I wonder if it is possible to have the equivlent libary for "rlogin" in Python? Because our local networks support only SSH or RLOGIN. This script used Telnet so it could not be used in our local networks;
1
1901
by: Stephen Ferg | last post by:
I'm trying to use telnetlib to run a Java program on a remote server. I'm having strange problems, and I'm wondering if anyone might be able to help. I have two UNIX servers, A and Z. I have an application named LATTE that runs on server A. When the user starts LATTE, the user can choose to create a telnet connection back to A, or to Z. Then LATTE uses the telnet connection to run a Java program (run it several times, on different...
3
6460
by: Mike Monaghan | last post by:
I'm rather new to python but a long time programmer. I think I've covered my bases so I hope this isn't somthing obvious. I'm running ActiveState PythonWin 2.3.2 (#49, Nov 13 2003, 10:34:54) on win32. I have several processes that are polling a telnet server on a regular basis. I'm using telnetlib for this. When I issue the .close method the connection is not closed (no TCP FIN is sent to the server).
3
12482
by: Wojciech Halicki-Piszko | last post by:
How to know if connection is active after telnetlib.Telnet.open(host,port)?
44
2244
by: Agoston Bejo | last post by:
What happens exactly when I do the following: struct A { int i; string j; A() {} }; void f(A& a) { cout << a.i << endl;
4
10520
by: vercingetorix52 | last post by:
I'm trying to use a python script to access an embedded computer running linux and connected via a crossover ethernet cable using the following script... ....and I realize the username and password is not realistic... I'm still in "proof of concept" stage here :) ######################### import telnetlib
0
1536
by: dtsearch | last post by:
A new beta build offers 64-bit developer access to dtSearch's "terabyte indexer," and preliminary MS Word 2007 and Excel 2007 support (in both 64-bit and 32-bit versions) BETHESDA, MD (July 22, 2006) dtSearch Corp., a leading supplier of enterprise and developer text retrieval software, announces a native 64-bit beta version of the dtSearch Text Retrieval Engine for Win & ..NET. The dtSearch Engine lets developers add dtSearch's...
3
3250
by: Phoe6 | last post by:
Hi All, I am trying to use the telnetlib module. Manually when I do telnet 172.31.128.244 I get: Login: (I type root) Password: ( I type Password) And it enters to the Telnet Session:
3
1445
by: DanBWeb | last post by:
I am trying to query SQL, based on a date For each term I have a record in the "TermDate" table: TemName StartDate EndDate Term 1 9/1/2007 11/21/2007 Term 2 11/22/2007 1/29/2008 Term 3 ... ... Seems easy enough, but I can't get it to pull the appropriate record. if xDate = 9/20/2007, the query should return me Term 1, for example.
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7519
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.