#2703·pwntools

`ssh.interactive()` doesn't interpret ansi escape codes in output

Author: peace-makerCreated Mar 24, 2026Updated Aug 13, 2026
Labelsbugbackport-required

Starting an interactive shell on a remote machine prints the ansi escape code in an escaped form instead of interpreting them on the command line. This might be since the term module rewrite #2242 @Arusekk?

They should be interpreted correctly and the colors should be displayed correctly.

python
ssh(host='bandit.labs.overthewire.org', user='bandit0', password='bandit0', port=2220).interactive()
...
  Enjoy your stay!

\x1b[?2004h\x1b]0;bandit0@bandit: ~\x07bandit0@bandit:~$ cd /home/bandit0
\x1b[?2004l\x1b[?2004h\x1b]0;bandit0@bandit: ~\x07bandit0@bandit:~$ id
\x1b[?2004luid=11000(bandit0) gid=11000(bandit0) groups=11000(bandit0)
\x1b[?2004h\x1b]0;bandit0@bandit: ~\x07bandit0@bandit:~$