Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58269 > unrolled thread
| Started by | 神父 <wxj0302@gmail.com> |
|---|---|
| First post | 2013-11-01 22:16 +0800 |
| Last post | 2013-11-01 14:36 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
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
| From | 神父 <wxj0302@gmail.com> |
|---|---|
| Date | 2013-11-01 22:16 +0800 |
| Subject | telnet problem |
| Message-ID | <mailman.1930.1383315408.18130.python-list@python.org> |
[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
[toc] | [next] | [standalone]
| From | Neil Cerutti <neilc@norwich.edu> |
|---|---|
| Date | 2013-11-01 14:36 +0000 |
| Message-ID | <bdhsk1F4r4eU1@mid.individual.net> |
| In reply to | #58269 |
On 2013-11-01, ???? <wxj0302@gmail.com> wrote: > 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. What goes wrong? -- Neil Cerutti
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web