# Keylogging in Ruby

**URL:** <https://www.ruby-forum.com/t/keylogging-in-ruby/111198>\
**Category:** Ruby\
**Created:** [August 3, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/keylogging-in-ruby/111198 "2007-08-03T19:30:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ari\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Post date:** [August 3, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/keylogging-in-ruby/111198/1 "2007-08-03T19:30:39Z")

</div>

Keylogging in Ruby

I’ve been attempting (feebly) to build a nice Telnet server recently.  
One of my (many) difficult tasks is  
retrieving characters from the other side of the 'net with the client  
hitting enter.

ie…

prompt\> look Gr\_  
prompt\> look GrGrog taunts you a second time!\_

I’m trying to use keylogging to prevent this from happening. Several  
things I have tried…

1. Using raw mode on the client’s side, and then initiating telnet  
with repeated IO.getc()s.
2. Using HighLine creatively…  
IO.ask("prompt\> ") {|q| word \<\< q}

Neither of those solved any of my problems, though I was sure the  
HighLine one would’ve worked.

So does anyone have any ideas or suggestions of what might work?

Thanks,  
~ Ari  
English is like a pseudo-random number generator - there are a  
bajillion rules to it, but nobody cares.
