telnet server ←————→ device ↑ | SSH ↓ localhost (me)
I have a device that is connected with one server computer and I want to talk to the device by ssh'ing into the server computer and send telnet commands to my device. How do I setup things in Python to make this happen?
You can use Python's paramiko package to launch a program on the server via ssh. That program would then in turn receive commands (perhaps via stdin) and return results (via stdout) from the controlling program. So basically you'll use paramiko.SSHClient to connect to the server and run a second Python program which itself uses e.g. telnetlib to talk to the device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With