Obfuscating/suppressing password output in TCPSocket?


#1

Hello,

I’m attempting to suppress the output of a password that is sent via
a TCPSocket. If I have the following code:

server = TCPServer.new( ‘127.0.0.1’, 8888 )
socket = server.accept() # socket is now a TCPSocket
password = socket.gets()

is there a simple way to suppress the password on the client side
(I.E., turn off client-side echoing of the password)? I know there is
a way to do this with sockets in C, but can’t figure out a way with
TCPSocket. Thanks!

Nate


#2

Nate Smith scribbled on Thursday 09 Mar 2006 21:46:

(I.E., turn off client-side echoing of the password)? I know there is
a way to do this with sockets in C, but can’t figure out a way with
TCPSocket. Thanks!

Nate

You’d need to implement the telnet protocol and make your peer use a
telnet
client in order to implement noecho.


#3

On Fri, Mar 10, 2006 at 05:46:12AM +0900, Nate Smith wrote:

is there a simple way to suppress the password on the client side
(I.E., turn off client-side echoing of the password)? I know there is
a way to do this with sockets in C, but can’t figure out a way with
TCPSocket. Thanks!

The issue isn’t with sockets, it’s with the client terminal. You need
to manipulate the terminal settings. I see ruby-password and
ruby-termios packages on RAA that might do what you want.

http://raa.ruby-lang.org/project/ruby-password/0.5.3

regards,
Ed


#4

Hello,

I created a server, accepted a connection via telnet, and if the
client sends a control-c, the TCPSocket hangs. It can still read
data, but writing to it produces no output on the client side. Here’s
the code:

server = TCPServer.new( ‘127.0.0.1’, 31337 )
socket = server.accept

now client (via telnet), sends control-c

socket.print “test” # <-- produces no output on client

Anyone know what’s up? I checked for exception throws and there are
none, and the server side keeps running normally, besides this.

Nate


#5

Sorry, the code should look like:

server = TCPServer.new( ‘127.0.0.1’, 31337 )
socket = server.accept

data = socket.gets # added this line

now client (via telnet), sends control-c

socket.print “test” # <-- produces no output on client