Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58269
| Date | 2013-11-01 22:16 +0800 |
|---|---|
| Subject | telnet problem |
| From | 神父 <wxj0302@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1930.1383315408.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
hello every expert,
When I use telnetlib to send a command, I meet some troubles, I have read
some documents about telnetlib and modify many times, but the script
doesn't work all the time. I want to know why.
My script is following:
#!/usr/bin/python
#
import telnetlib
t = telnetlib.Telnet()
t.open('192.168.1.1',port=23)
t.set_debuglevel(2)
t.read_until("login: ")
t.write('administrator' + '\r\n')
t.read_until("password: ")
t.write('abc123' + '\r\n')
t.read_until(">$")
t.write('dir' + '\r\n')
t.write('exit' + '\r\n')
print t.read_all()
Thanks and best regards
W
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
telnet problem 神父 <wxj0302@gmail.com> - 2013-11-01 22:16 +0800 Re: telnet problem Neil Cerutti <neilc@norwich.edu> - 2013-11-01 14:36 +0000
csiph-web