Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'modify': 0.07; '")': 0.09; 'times,': 0.14; 'command,': 0.16; 'expert,': 0.16; 'import': 0.22; 'print': 0.22; 'subject:problem': 0.24; 'why.': 0.24; 'script': 0.25; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:# 10': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'skip:t 30': 0.61; 'from:charset:gb2312': 0.81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ZFm2yM5y02C52UmGaGzaZrJWxf9oUVjz3N9Qo4a2po0=; b=v7c1bSdOXzQ6q8tF4WNRp05PhGMY50bbyLAqHr4yrmFGEcJua/iu6vvEqyJb5JyVXq w5/P77W8oZ5wfaZ4W5VesxfWTreXelwY/vlSRCb/Urwwpe4MyyitCptzqBpZjzhbVY3O Sl/ofdibqGtpFEfjAtQkjMbj2LtwhOozv4c9GHp7oe5hMtSaBHOfsl20yrDblP3hmgmQ rIU23Mv6Pdlqm4YDeJWiHjpuMUqNxyhv3PGdYr7t0RE5sVJISuRWYdnCXUWUsQbzvK/x 5SPGmGM6ZA4gWSU/vcGjH9RoulYl+ZFxsGCp2fX4udJdmlIw2pC/YnFzs4d0YXhRxvx0 AKAg== MIME-Version: 1.0 X-Received: by 10.220.78.18 with SMTP id i18mr2193172vck.3.1383315400563; Fri, 01 Nov 2013 07:16:40 -0700 (PDT) Date: Fri, 1 Nov 2013 22:16:40 +0800 Subject: telnet problem From: =?GB2312?B?yfG4uA==?= To: python-list@python.org Content-Type: multipart/alternative; boundary=047d7b3a8b0210218d04ea1e374f X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383315408 news.xs4all.nl 15921 [2001:888:2000:d::a6]:43977 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58269 --047d7b3a8b0210218d04ea1e374f Content-Type: text/plain; charset=ISO-8859-1 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 --047d7b3a8b0210218d04ea1e374f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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 =3D telnetlib.Telnet()
t.open('192.168.1.1',port=3D23)=
t.set_debuglevel(2)
t.read_until("login: ")
t.write(= 9;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
--047d7b3a8b0210218d04ea1e374f--