vt100 terminal emulation using python/browser
I’m trying to build an SSH client for a web browser (similar to ajaxterm). I’ve built a SSHClient.invoke_shell (term=’vt100′) using Paramiko’s
and a web server (HTML + AJAX) that communicates with the front end. When I send the command over the SSH channel, the system works and displays the output, but the output includes the VT100 escape sequence.
If I understand correctly, anything I get from SSH channel should be interpreted as a command for a 24×80 terminal window? This means that escape sequences may change colors, clear the screen, delete lines, change the way lines behave… (I found a good list here) This means I can’t just clear them?
looked at the source code for Ajaxterm but couldn’t figure out how to use the Terminal class (so I can use it for my purposes).
Question: What is the easiest way to interpret the output stream and display the terminal screen correctly in the browser? In other words, is there a library that parses the output and preserves screen content for me?
Please let me know if I misunderstand the inner workings of the terminal. I didn’t have much experience with them in the past. 🙂
I tried to do the same thing a few days ago. I didn’t finish it, but I found some python terminal emulator libraries.
I chose pyte, which has a clean API and is easy to use. A list of other libraries that do the same work is provided at the end of pyte’s README.