Obfuscating/suppressing password output in TCPSocket?

N

Nate Smith

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
 
B

Bernhard 'elven' Stoeckner

Nate Smith scribbled on Thursday 09 Mar 2006 21:46:
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

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

Edward Faulkner

--1LKvkjL3sHcu1TtY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

is there a simple way to suppress the password on the client side =20
(I.E., turn off client-side echoing of the password)? I know there is =20
a way to do this with sockets in C, but can't figure out a way with =20
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

--1LKvkjL3sHcu1TtY
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEEKy7nhUz11p9MSARAgViAJ4jMAz87Io640CoPvvF8q3dNaaUIwCg3Wld
jVh7QcntdqKdE38oe3BU7c8=
=bBSW
-----END PGP SIGNATURE-----

--1LKvkjL3sHcu1TtY--
 
N

Nate Smith

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
 
N

Nate Smith

--Apple-Mail-1-466960952
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

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



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


--Apple-Mail-1-466960952--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top