Telnet connection

Riss Nicolas alien275 at libertysurf.fr
Thu Feb 28 13:51:06 EST 2002


Has somebody a python program where it is an telnet connection ?
"Bengt Richter" <bokr at oz.net> a écrit dans le message de news:
a5k352$etg$0 at 216.39.172.122...
> On Wed, 27 Feb 2002 19:14:22 +0100, "Riss Nicolas"
<alien275 at libertysurf.fr> wrote:
>
> >No, the port is correct. The telnet server is cingured to listen of the
port
> >32.
> >Another suggestions ?
> >
> >Thanks
> >"Mike Johnson" <afp_randjohnson at yahoo.com> a écrit dans le message de
news:
> >8z9f2rks.fsf at fido.trinitycapital.com...
> >> "Riss Nicolas" <alien275 at libertysurf.fr> writes:
> >>
> >> > I jave used it but when y tried to connect it makes an error:
> >> >    File "c:\test.py", line 9, in ?
> >> >     tn = telnetlib.Telnet("192.168.0.9",32)
> >> >   File "C:\PROGRA~1\python22\lib\telnetlib.py", line 190, in __init__
> >> >     self.open(host, port)
> >> >   File "C:\PROGRA~1\python22\lib\telnetlib.py", line 219, in open
> >> >     raise socket.error, msg
> >> > socket.error: (10061, 'Connection refused')
> >> >
> >> > Programm:
> >> >
> >> > import getpass
> >> > import sys
> >> > import telnetlib
> >> > password = getpass.getpass()
> >> > tn = telnetlib.Telnet("192.168.0.9",32)
> >> > tn.read_until("Administrator Password : ")
>                     ^^^^^^^^^^^^^^-?      ^-^-??
>                     \_ worth double checking _/
> >> > tn.write(password + "\n")
>                           ^^--need \r\n for default telnet protocol, IIRC
> >> > tn.write("session\n")
>                       ^^--need \r\n ?
> >> >
> >> >
> >> > Where is the mistake ?
> >>
> >> Wrong port. Try:
> >>
> >> tn = telnetlib.Telnet("192.168.0.9", 23)
> >>
>
> I'd log in manually with any normal telnet client
> to double check the prompts.
>
> HTH,
> Regards,
> Bengt Richter
>
>





More information about the Python-list mailing list