Repository navigation
add stdin remapping support - #23
Conversation
There was a problem hiding this comment.
@lunixbochs, Maybe netfd is not working here? Have you tried this yet?
There was a problem hiding this comment.
It doesn't work and isn't likely to ever work. You're in raw mode for operations already. Why are you using the crypto/ssh/terminal library to read passwords? Just stop echoing characters for the line.
There was a problem hiding this comment.
@lunixbochs I haven't dig out a lot about how it implement, I'm not sure it's as simple as stop echoing characters.
Anyway, it seems not breaking anything. Thanks for you pr!
There was a problem hiding this comment.
Oh, my suggestion was a result of looking at the source for terminal. They literally just set t.echo = false then read a line:
https://github.com/golang/crypto/blob/master/ssh/terminal/terminal.go#L649
Also when I said "it doesn't work", I mean it throws an error about being unable to configure the device. The only way to fix this would be reading passwords from your own code (by disabling echo, then reading a line in raw mode).
This allows replacing Stdin with a socket other file interface as requested in #14. I'm using this in my Usercorn project for a remote debugging interface. I made the API use a new
FdReaderinterface for Stdin in lieu of usingos.Filefor ease of wrapping. The connecting client is expected to manually place stdin into raw mode.This shouldn't break any existing features as it falls back to the global Stdin object for normal use.
Here's what the server-side looks like: https://github.com/lunixbochs/usercorn/blob/master/go/usercorn/debugger.go#L40
Here's the client-side (where I manually set raw mode on stdin): https://github.com/lunixbochs/usercorn/blob/master/go/usercorn/cli.go#L74