Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #58269

telnet problem

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 <wxj0302@gmail.com>
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; '&quot;)': 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 神父 <wxj0302@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1930.1383315408.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[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 | NextNext in thread | Find similar | Unroll thread


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