I'm using a pxssh to make connection to remote server and do a some commands, after that i need to return a stdout and push it to my html webpage.
This construction is not work because it's give all output (command and output) in string (without any formatting)
(pxssh code here)
cmd4 = ls -l /var
s.sendline(cmd4)
s.prompt()
result=s.before
return render_template('results.html', the_results=result)
this:
(pxssh code here)
cmd4 = ls -l /var
child = pexpect.spawn(cmd4, encoding='utf-8')
return render_template('results.html', the_results=child.read()
Not working to because this code performs locally (i don't understand why)