I am writing a simple script to check the ownership of a file. It is all working as expected but I am getting some random (or not) characters in the output.
here is the script:
import pexpect
p=pexpect.spawn('ssh root@%s'% addr)
p.sendline("ls -l /etc/gshadow")
p.expect("root@system:~#")
print("CMD %s:\n" %p.before.decode())
and here is the output
CMD ls -l /etc/gshadow
lrwxrwxrwx 1 root root 15 Jun 22 08:46 /etc/gshadow -> /home/+/gshadow
:
^[[64;5Ruser@system:~/home$ 4;5R
Why do I get these characters surrounding the prompt and how can I prevent that?