Trying to read from interactive remote session using rpyc hanged

20 views
Skip to first unread message

Deya Rimawi

unread,
Jul 29, 2018, 8:08:18 AM7/29/18
to rpyc

I am trying to read an output from an interactive session and wait for the next command. This is performed using RPyC connection.

Example:

from subprocess import Popen, PIPE
from time import sleep
import sys
import rpyc

rp = rpyc.classic.connect("x.x.x.x", port=18812)
sp = rp.modules.subprocess.Popen("openssl",
                                 stdin=rp.modules.subprocess.PIPE,
                                 stdout=rp.modules.subprocess.PIPE,
                                 stderr=rp.modules.subprocess.PIPE,
                                 shell=True)
print(sp)
# Send Command #1
sp.stdin.write("speed rsa2048\n".encode())
sp.stdin.flush()
sleep(0.1)
data = sp.stdout.read() # Script hangs here
print(data.decode())
Reply all
Reply to author
Forward
0 new messages