Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can anyone help me with the following please:
I am trying to write a security program to authenticate users who are logged into Windows while they are using any application through their typing pattern. It does this by taking timings between keystrokes and processing them somehow.
My main problem at this point is how make my program run in the background and collect keyboard events/interrupts from everything that the user types into any currently active application (or even just desktop).
I would like some methods/classes that deal with this in Java preferably or maybe VB.NET. Some sample code would help greatly too.
I have looked around a bit but but am not sure that simple event handlers can do the trick. Can they?! Do I need to go more low level?
Thank you in advance.
P.S. I am an intermediate programmer in Java

How on earth is logging what someone is typing into an application going to authenticate then as a user - they could be typing almost anything, including a load of crap. What do you mean by typing pattern?
What you are talking about is a key logger. A key logger *IS* spyware. No one is going to help you write a programme that helps you spy on people.
Stuart

Hi Stuart,
I'm glad you said that.
I thought it was just my suspicious nature.
If at first you don't succeed, you're about average.M2

I am NOT trying to write spyware!! What I am talking about is a program that authenticates a user by building a profile of average timings between keystrokes. eg Bigrams like "at, is, it" and Trigrams like "and, the, end" etc. I am NOT really interested in what the user is typing at all!!! Just their typing pattern based on keystroke dynamics. Something similar to the Biopassword product that does this only at login. I want to extend it so that it can monitor the user during actual use of applications too as this would improve security.
Sorry if I came across as wanting to write spyware. I strongly disagree with spyware and that is not my intention.

P.S. If you still feel that I am trying to write something inappropriate then simply do not reply to my post. This was something that was part of my uni project and I am just following it up.

Should we not comment on possible inappropriate behavior, I think not. To capture keystrokes using any application you would have to write it at the lowest level. To analyze it is another problem. The easiest way is to store it with metrics is to make it a keyboard logger with storage of additional data. This might make it slow the computer down appreciably. Analyzing general application input is far more difficult than just analyzing password entry.

I think you are asking the impossible. It is easy to monitor key timings for something like a password where the application knows what is being typed and the user is familiar with what they are typing.
However, when a user is inputting into an application, then things get a bit different. It depends whether the user is typing there own words like I am now, or copy typing, which is a lot slower. Plain English like this is one thing, if it is a technical document with long word the user is unfamiliar with, then the typing will be even more slower. Then there are numbers to consider if the user is using a spreadsheet. Slower again.
To do what you are trying to do you are going to have to intercept the keyboard interrupt. That's more complicated than a key logger where all that has to do is read the keyboard buffer with no interest as to how long the information has been in the buffer. You are going to have to delve into the innards of the Operating System and assembly would more suitable for that as timing is critical.
Even if you do manage to build up a profile over a period of days or weeks, it is going to be meaningless if the user an application they have never used before or they have a bad day with a stinking hangover!
Stuart

Thanks to all for your help.
Stuart - I am aware of the fact that different applications and moods of the typist affect timings. This was more or less what my project was about previously. Part of my plan to overcome this to an extent was to focus on certain "typing intensive" applications like e.g. Word. However I wasn't very sure how to capture keystrokes from other applications so I settled for capturing all keystroke events. Maybe this would be a better route. Is this possible?
My suspicion was that I would need to go down to using assembly for such a task - just needed another opinion. This brings me to my second problem - If I made an assembly program to output the timings is it possible to capture the timings in a Java application for example?
wizard fred - I am glad that people are vigilant towards possible malicious behaviour and can see how my original post could have come across that way. And of course you should comment. Thank you.

Once you gather enough data, which would be a bunch, I think you're looking at a neural net/AI.
Sounds like a crapshoot because as mentioned earlier, people type differently at different times of the day/month and dependent on blood sugar/alcohol/stimulant etc etc.
If at first you don't succeed, you're about average.M2

Hey I guess there's nothing wrong with experimenting...I don't have a ton of faith in your project, but I have done a bit of keystroke capturing in .NET, so I can help you there.
I did my project primarily to create a joystick to keyboard/mouse mapper. It worked OK, but the problem I ran into was that when programs used DirectInput for keyboard input, the windows dlls that I used to capture keystrokes weren't low level enough to ever get the messages. I gave up since the only programs I was interested in controlling were games, which mostly use DirectInput. It would work fine for stuff like Word though.
Anyway, here's a codeproject link to get you started. As a Java programmer, you'll find C# syntax very familiar.
I'll see if I can dig up my code somewhere...Maybe you'll find it helpful.
Good luck,
-SN

Thank you SN!
Like you say am just experimenting. Although I have read several leading papers on the subject and believe that it is possible to some extent.
Some code would definitely be the way forward if you can find any. That would be a great help. The link you sent looks good too.
Thanks

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |