Can Ruby be a keylogger on Win/Mac?

I know the subject’s vague; that’s because I don’t know what I’m talking
about.

Is it possible to write an Ruby program that will intercept keystrokes
on
Windows XP? I’m on Windows at the moment, but I’m switching to Mac
soon.
(Then again, I’m not sure if a Mac keylogger would be low-level enough
to
get keystrokes destined for a Parallels virtual machine running Windows,
so
both may be important.)

No, I’m not doing anything nefarious. In fact, here are the specs for
what
I want to write, and I’d probably give a small bounty to someone who did
this SMOP:

  • Measure the average percentage of keystrokes that are either delete,
    backspace, or cursor keys
  • If that percentage is significantly higher than normal (for some value
    of
    “significantly”), pop up a modal alert
  • Don’t be a CPU hog; maybe even self-disable when the computer is idle

And if you know me, or dig a little, you’ll know exactly why I want
that.
:slight_smile:

If it can hide from the process list or otherwise make itself difficult
to
close, all the better, but that’s not strictly necessary. It’s fine if
it
needs Administrator/root permissions to run.

You’re going to have a hell of a time building a keylogger for OS X.
You’ll want to look into the input managers. The same thing for
building an Input Method for another language.
With that part of Cocoa, you could definitely monitor input.
Beware though, the docs are dense, and there is big learning curve.
Also, input methods tend to cross the gap between Cocoa and Carbon
(basically between Obj-C and C frameworks)

You might try an AppleScript layer that intercepts and then passes
the same keystrokes… (System Events)

You can hook WMI if you want to and I bet you could somehow figure out
keyboard events from there.

I don’t have a clue about OS X…

–Jeremy

On Dec 29, 2007 3:25 PM, Jay L. [email protected] wrote:

I want to write, and I’d probably give a small bounty to someone who did


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book
http://www.humblelittlerubybook.com/

My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/

For windows:

http://msdn2.microsoft.com/en-us/library/ms997537.aspx

I don’t know about OS X, from what I understand, it’s hotkeys only,
but keep looking…

On 29 Dec 2007, at 22:42, John J. wrote:

InputManagers are only loaded into applications that load the cocoa
runtime and are sort of on their way out. The lowlevel functionality I
would look at would be a CGEventTap (see CGEvent.h)

Fred

On Dec 29, 2007, at 5:53 PM, Frederick C. wrote:

You might try an AppleScript layer that intercepts and then passes
the same keystrokes… (System Events)

InputManagers are only loaded into applications that load the cocoa
runtime and are sort of on their way out. The lowlevel
functionality I would look at would be a CGEventTap (see CGEvent.h)

Fred

Shows how much I (don’t) know… :slight_smile:
I was reading the (still terse docs) on the newer input manager
system, but it was pretty heady.
In abstracting it further for Cocoa, it seems they’ve also given it a
steeper learning curve, which sophisticated input should have, since
it is intended for handling complex language input really.

It is interesting that the Core Graphics things hold many keys to
input, supposedly geared toward game development?

Perhaps there are some RubyCocoa CGxxxx wrappers?

On Sat, 29 Dec 2007 19:18:03 -0500, John J. wrote:

I was reading the (still terse docs) on the newer input manager
system, but it was pretty heady.

Isn’t there also something about them being deprecated/hard to
use/insecure
in Leopard? Or is that the old system that the CGEventTap replaces?

On 30 Dec 2007, at 00:35, Jay L. wrote:

On Sat, 29 Dec 2007 19:18:03 -0500, John J. wrote:

I was reading the (still terse docs) on the newer input manager
system, but it was pretty heady.

Isn’t there also something about them being deprecated/hard to use/
insecure
in Leopard? Or is that the old system that the CGEventTap replaces?

InputManagers are now officially deprecated. They also have to be
installed in /Library, owned by root which they didn’t used to.

Fred

On Dec 30, 2007, at 1:49 AM, Frederick C. wrote:

in Leopard? Or is that the old system that the CGEventTap replaces?

are they?
NSInputManager and NSInputServer don’t seem to be deprecated in the
docs…

is there anyway to do this on linux machines with root access ?

On Dec 30, 2007 5:40 PM, John J. [email protected]

http://www.keylogger-mac.com Mac keylogger

I am not a professer in mac, I just know something about Windows.
Here are some keylogger software for PC.
http://www.microkeylogger.com/
http://www.pc-remote-monitoring.com/

Coming to keylogger for mac, Amac
Keylogger(http://www.amackeylogger.com) is not a bad choice too.

any of the keylogger for Mac above free to use?

Emma Evans wrote in post #1071752:

any of the keylogger for Mac above free to use?

No, all of them are just free to try. Called “shared software”!
You can try this one: http://www.anykeylogger.com/keylogger.html which
is cheaper than them.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs