I dry on a Python script. I create a python script for a given IP will connect via Paramiko to a server to execute another Python script.
Here is some code:
self._client = paramiko.SSHClient()
self._client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self._client.connect(self._ip, username=self._server['username'], password=self._server['password'])
channel = self._client.get_transport().open_session()
channel.exec_command('python3 /tmp/scrap.py /tmp/' + self._ip + '.txt 0 1')
The script "scrap.py" returns every X seconds a line in the console of the remote machine, but I can not recover as and when these lines in the script above (at the exit of exec_command (. ..)).
Is this possible, and if so have you any idea how?
Thank you in advance.