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?
Use tunneling by setting up a SSH session that tunnels the Telnet traffic:
So ssh from localhost to server with the option -L xxx:deviceip:23
(xxx is a free port on localhost, device is the IP address of "device", 23 is the telnet port).
Then open a telnet session on your localhost to localhost:xxx. SSH will tunnel it to the device and response is sent back to you.
How to run telnet over ssh in python