Telnetlib & Term Types

Svha news at svha.demon.co.uk
Sat Nov 20 06:02:22 EST 2004


My bad - omitted the set_debuglevel() output from the above post ...
Hey it was a Friday afternoon ;)

>>> tn = telnetlib.Telnet(xxx.xxx.org)
>>> tn.set_debuglevel(10)
>>> tn.mt_interact()
Telnet(xxx.xxx.org,23): recv "\xff\xfd\x18\xff\xfd \xff\xfd#\xff\xfd'"
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\xff\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\nError opening'
Debian GNU/Linux 3.0 xxx.xxx.org
Error openingTelnet(xxx.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/module-telnetlib.html
> 
> import sys, telnetlib
> tn = telnetlib.Telnet("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




More information about the Python-list mailing list