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.
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)
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)
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…
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?