hanslub42 / rlwrap

A readline wrapper
GNU General Public License v2.0
2.59k stars 151 forks source link

Asterisks when tty echo is off. #117

Closed the-emmon closed 3 years ago

the-emmon commented 3 years ago

Hey there,

Having some trouble getting rlwrap to do what I need it to. It's being used for tab completion and arrow key capabilities in the context of a reverse ncat powershell terminal from Windows to Linux, with Linux acting as the listener. Initially, just running the linux nc listener through rlwrap, the terminal history (visual, not command history) doesn't show the prompt I typed into, just the input, and it echoes the output from windows (the same string) right back at me. This makes it really hard to parse what's been done, since there's no prompt and it's just a bunch of "ipconfig ipconfig COMMAND OUTPUT", for instance.

This is all completely fixed when I execute "stty -echo" on my linux control box before running the rlwrapped nc listener, but everything I type in rlwrap, despite the fact that autocomplete still works, is displayed as asterisks. Once I hit enter, the command I typed as asterisks appears perfectly in plaintext with the prompt from Windows, visually archived exactly as it would look if I'd been typing natively into Windows powershell, which is my goal. In addition to the asterisk issue, the rlwrap prompt color resets to plain coloring upon the first asterisk character showing up -- not a big deal, but it does challenge my dream of a blue prompt :)

It seems as though the behavior I'm having trouble with was implemented in update 0.12 as a feature to hide passwords: "When slave pty's ECHO flag is unset (e.g. when entering a password) rlwrap now displays asterisks for every input character like this: Password: **". This implementation makes sense for passwords, but this also prevents my intended usage. Would it be possible to toss in a flag to deactivate this?

Thanks! Ryan

hanslub42 commented 3 years ago

This use case has never come up until now, but it makes sense to add another option for this: -E or --always-echo cf ae56617e9c7645198be2a477c4aa10b31465fa4b