Python step by step telnetlib output message

Enes ERGUN

I am working on configuring an ip telephone using python.I can access the ip telephone via telnet, but i want use python.

my code:

user = "admin"
password = "admin"
tn = telnetlib.Telnet("192.168.1.191",23)
output = tn.read_until("Login:")
tn.write("admin".encode("ascii")+ b"\r\n")
tn.read_until("Password:")
tn.write("admin".encode("ascii")+ b"\r\n")
tn.write("help".encode("ascii")+ b"\r\n")
output = tn.read_all()
tn.close()
print output

but this does not work as it results in an infinite loop without printing any output.

Thanks for your help in advance.

iLoveTux

as per the documentation read_all blocks until the connection is closed. You'd probably be better off figuring out what the last line of output should look like (a prompt maybe?) and using read_until like you've been doing. You can also look into read_eager, read_very_eager or read_some.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Mark Argo workflow step as skipped based on the step's own output

From Dev

Advice for tool or a script to report a step by step Python file execution

From Dev

Drawing on JPanel step by step

From Dev

Python enumerate downwards or with a custom step

From Dev

Setup EC2 for Python 2.7, Step-by-step

From Dev

Python: Add text to step plot

From Dev

Step through for Python loop with step size given in exponentials

From Dev

Pass current step output to next step and write to flatfile

From Dev

Python decimal range() step by step value

From Dev

Jenkins Workflow: Parallelize step based on tool output

From Dev

Capturing step by step actions

From Dev

Run github actions step based on output condition

From Dev

Capturing step by step actions

From Dev

Animate position step by step

From Dev

The output is differ when debugging vs Step Into solution

From Dev

PyMC: sampling step by step?

From Dev

Drawing on JPanel step by step

From Dev

Python: Add text to step plot

From Dev

how to concatenate the output of vlookups in one step

From Dev

For loop - missing last step if the output is NULL

From Dev

Google authentication step by step

From Dev

Pass current step output to next step and write to flatfile

From Dev

ruby cucumber - step undefined message but step exists in step_definitions

From Dev

Angularjs step by step form

From Dev

Python Code Understanding the code step by step

From Dev

EMR spark step and merge output into one file

From Dev

Incorrect pattern message configuration on CombinedSignInSignUp step

From Dev

Normalization / Scaling as preprocessing step in python

From Dev

randrange python step parameter in minutes

Related Related

HotTag

Archive