Run the command on the remote machine using telnet on one line

I would like to execute a command on a remote machine using telnet as,

telnet xxxx command or similar

I want to include this as part of a script in Python (a subprocess) and therefore need it on one line. Or are there other ways to do the same?

Any help is appreciated.

Thank.

+3
source share
3 answers

Instead of relying on subprocess, you can try using Python telnetlib.

A complete example that does practically what you need is available as an example in the documentation: http://docs.python.org/library/telnetlib.html#telnet-example

, SSH . , SSH- SSH (, ssh user@example.com ls -l).

+1

, , , , , /.

, ssh- - . : SSH Admin Ease

0
#!/bin/sh
empty -f -i in -o out telnet foo.bar.com
empty -w -i out -o in "ogin:" "luser\n"
empty -w -i out -o in "assword:" "TopSecret\n"
empty -s -o in "who am i\n"
empty -s -o in "exit\n"

http://empty.sourceforge.net/

0
source

All Articles