Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telnet does not seem to work #226

Open
alex4200 opened this issue Jun 14, 2023 · 1 comment
Open

Telnet does not seem to work #226

alex4200 opened this issue Jun 14, 2023 · 1 comment

Comments

@alex4200
Copy link

alex4200 commented Jun 14, 2023

I can use telnet to telnet to a device as follows

telnet 192.168.200.10 9000

so I can run a command like $SYS,INFO.

I am trying to use exscript to do the same:

from Exscript.protocols import Telnet

conn = Telnet()             
conn.connect('192.168.200.10', 9000) 
a = conn.send('$SYS,INFO')  # Execute the "uname -a" command
print(a)

But I get None. So not sure how to send a command, if I am connected, how to get the "welcome" message. I had a thorough read through the telnet documentation here:

https://exscript.readthedocs.io/en/latest/Exscript.protocols.telnet.html

Really, I read that page in great detail! But it did not help to solve my problem.

I also tried the telnetlib example as follows:

from Exscript.protocols.telnetlib import Telnet
tn = Telnet('192.168.200.10', 9000)   
print(tn.read_all())

but this seems to be stuck at the "read_all" step ...

@VoxDai
Copy link

VoxDai commented Jun 22, 2024

The response is stored in Telnet().response. This may be what you want:

from Exscript.protocols import Telnet

conn = Telnet()
conn.connect('192.168.200.10', 9000)
conn.execute('$SYS,INFO')  # Execute the "uname -a" command
print(conn.response)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants