I am building a terminal window in a browser (sth. like ajaxterm) and don't know which escape sequence to send to ssh tunnel (opened via paramiko.SSHClient().invoke_shell(term='linux')
).
I have found a key logger and tried it in a terminal with $TERM == 'linux', but it returns the same sequence for ctrl+left
and left
(27,91,68).
If I try keylogger in another terminal (with $TERM == 'xterm') I get the codes (27,91,49,59,53,68). But these codes do not move generate the expected output from SSH channel (which would move cursor one word left on a normal linux shell). That is true even if I start paramiko with term='xterm'.
Any idea what sequence I should use? Or why the above sequence doesn't work?
UPDATE: I would be happy to use another terminal type (not "linux"), but unfortunately pyte works with VTxxx terminals only (I believe "linux" is vt220-like terminal - anyway, it works), so xterm doesn't work properly.
All the format strings shown so far have ended in \n . This kind of construct is called an escape sequence. All escape sequences are made from a backslash character ( \ ) followed by one to three other characters. Escape sequences are used inside strings, not just those for printf, to represent special characters.
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text.
ESC[0m. reset all modes (styles and colors)
A quick check with od -c
reveals that gnome-termainal generates these values:
Left-arrow generates ESC
-[
-D
.
Control-left-array geneates ESC
-[
-1
-;
-5
-D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With