I am new to python and if the question is very nooby i apologize. Simply put i need to write a script that connects to remote via ssh then telnets to localhost and execute a command on a shell there.
I am using Python 2.4.3. I have read alot of similar questions here , and alot of people suggest to use modules such as Paramiko, Pexpect etc. However this is out of question - i am supposed to use only "native" 2.4.3 libraries. I have tried messing around with subprocess module and i have managed to connect to remote shell (however i need to provide a password - and i would like to avoid that by providing a password in script for example) - but still i need to do a telnet to localhost and execute few commands on a different shell.
Could someone be so kind and give me some hints? Thanks in advance.
TL;DR I am looking for python alternative to this bash command :
./sshpass -p password ssh username@$ip -t "(sleep 1;echo "command" ; sleep 1) | telnet localhost $port;exit;bash" >> testing.txt
sshit makes no sense totelnet localhost-- it just adds an insecure local second connection.socketcalls. Is that what you want?