Friday, February 25, 2011

Woohoo! A simple keylogger!

After a full day of work (below) and a good meal it was time to play.

I enjoyed Jono Bacon's distinction between systematic and opportunistic developers (Linux Format 140 January 2011 Get developing ):
     http://www.linuxformat.com/archives?issue=140


This is me.

Everything I do I do intensely. Document it, analyse it, etc. And I get tired like everyone else, and sometimes just stretch out on the sofa and go to sleep.

So I would like to know when all that intense activity ceased.

Solution? A keylogger. Something that will record any keyboard activity with a time stamp.

I tried inotify. A great program, but much more complex than I need. I just want to know when I checked out.


Tonight I came across logkeys:


http://code.google.com/p/logkeys/downloads/detail?name=logkeys-0.1.1a.tar.gz&can=2&q=

Easy install:
     Untar it then (as root)
     ./configure
     make
     make check
     make install

Very simple, very cool, very minimalist, very high entropy. Simply records keystrokes to a log file with a time stamp.

Awesome.

My command is (as root):

     logkeys -s -o /Desktop/logkeys.log &

Doing this as root makes the file unreadable by the user, so again as root:
     cd /Desktop
     chown -R $user:users *
     chmod -R 0755 *

A sample output:

2011-02-25 23:43:27-0500 > doing this as root makes the file unreadable by the user, so again as root:b     b     cd /desktop
2011-02-25 23:44:17-0500 >      chown -r andy"$user:users
2011-02-25 23:44:36-0500 >      chmod -r 0755 *<#+3> *b
2011-02-25 23:45:03-0500 > bvery bcool.
2011-02-25 23:45:15-0500 > <#+67>
2011-02-25 23:45:27-0500 > a sample output:
2011-02-25 23:45:33-0500 >

Very cool.

So it is now late (as shown by the log) but not too late. Tomorrow I'll bet it can be tweaked. For example, I don't really need the time zone and we could do without the scrolling and navigation records.

But all in all very cool for what I want.

Well done.

No comments: