Max keylogger

Dec 5, 2006 at 4:00am

Max keylogger

Hello , I’m back on this list after 2 years of inactivity!

I’d like to implement a keylogger using Max (something that captures any
pressed key even if the Max window is not on top).

Is there a way to do this using household objects ? or is Java/C code needed
?

I’ve heard about the external ice.key that does just that but it’s not free
and I’m not ready to spend money on 0′s and 1′s..

Thanks for your help,

GP

#29043
Dec 5, 2006 at 9:58am

On 5-Dec-2006, at 5:00, william potage wrote:

> I’d like to implement a keylogger using Max (something that
> captures any pressed key even if the Max window is not on top).

ice.key from iCE tools does this. (URI below)

> Is there a way to do this using household objects ? or is Java/C
> code needed ?

ice.key uses some pretty low-level C. I doubt that Java would let
you go that deep and dirty. The standard key object & friends only
get keystrokes from the main Max event loop and have no way
whatsoever of accessing keystrokes when in the backround

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

#89842
Dec 6, 2006 at 4:04pm

Peter Castine wrote:
> Is there a way to do this using household objects ? or is Java/C code
> needed ?
>
> ice.key uses some pretty low-level C. I doubt that Java would let you
> go that deep and dirty.
Right. Doing this in Java *is* a nightmare. Glad you’ve made it in C,
’cause it’s not easy too ;-)

f.e

f.e chanfrault | aka | personal computer music
> >>>>>> http://www.personal-computer-music.com
> >>>>>> |sublime music for a desperate people|

#89843
Dec 28, 2006 at 6:46pm

On Dec 5, 2006, at 5:00 AM, william potage wrote:

> Hello , I’m back on this list after 2 years of inactivity!
>
> I’d like to implement a keylogger using Max (something that
> captures any pressed key even if the Max window is not on top).
>
> Is there a way to do this using household objects ? or is Java/C
> code needed ?

Apparently, Hi can do this. Select keyboard as input, map the
keycodes (or whatever Hi is outputting) to ASCII, and you’re good to go.

I just briefly tested this using hi.help and max runtime (don’t have
license on this machine), but it does seem to work across the system
(including system password dialogs!)

klif

#89844
Dec 28, 2006 at 10:59pm

Hi,

Please, could you post the link to this ASCII ?
I can’t find it.

Thanks,
Philippe

#89845
Dec 28, 2006 at 11:53pm

> ,
>
> Please, could you post the link to this ASCII ?
> I can’t find it.

Hm, I don’t have max installed at hand so i can’t make example patch,
but you need to map Hi output values of each key to appropriate ascii
codes.

you could do mapping using hi, coll and key objects. hi object’s
output will be coll adress and key object’s ascii code output will be
coll value. at the same time use itoa to check if the ascii value
matches the actual keypress. when you press all the keys on a
keyboard, you have your map. you could also map the output of hi
directly to the ascii character that comes out of itoa object.

Things will get more complicated with double/triple keypresses using
shift, option or both. Hi doesn’t care for shift or option,it only
outputs two keypresses at the same time. If you want capital letters
to map, you would have to keep track of whether shift or option are
pressed and for how long. It could get quite complex, but for basic
text it should be fairly easy.

see info for key and itoa objects. that should get you started.

klif

#89846
Dec 29, 2006 at 12:06am

Hi klif,

Thank you very much!
I thought first you were using the ASCII object.
(was in a ftp repertory at Ircam…)
No problem to deal with standard Max objects.

Thanks again,
Philippe

#89847
Dec 29, 2006 at 9:10am

I had been wondering about this last year sometime, when I wanted to keep track of a user’s activity in another app — does anybody know how to get the name of the front-most app? This would make it possible to have Max respond to key-commands in certain ways depending on which app is in the foreground… Could be handy.

J.

#89848
Dec 29, 2006 at 9:29am

If you’re on Mac, that sounds a good job for AppleScript.

Bye

#89849

You must be logged in to reply to this topic.