PDA

View Full Version : [JAVA] Key Logger Help


dwj100uni
10-07-2005, 01:40 AM
Hi everyone.

I have read all of the Homework posts and have also done a search on the whole forum and still have not been able to find any information that helps me with my problem; I was hoping that someone may be able to help.

I have spoken to my lecturer and carried out alot of research but connot find the information that I need.

Basically, I need to know how that Java could be used to record the keystrokes of a user and then store them into an external file. Or even whether or not that Java CAN actually do this?? More importantly the software needs to work when it is not the active program running on the PC (i.e. it is not the active window), and it needs to install discreetly on the users computer.

If anyone can help me I'd be extremely grateful, as I am truly stuck.

Thanks very much,

David

KeZZeR
10-07-2005, 02:24 AM
That sounds dodgy. A key logging application that needs to install discretely and is a hidden application?

Yes you can log key events with Java, but if the window is out of focus then i'm not sure if you can. KeyEvent I think is the standard keystroke event class but i've never used it personally.

punx
10-07-2005, 05:09 PM
While on the subject of key logger... What do you need to import to instantiate a newy KeyStroke object? Heres the code I have:

import java.awt.AWTKeyStroke;
import javax.swing.KeyStroke;
...
KeyStroke k = new KeyStroke();
...
System.out.println("Type something: ");
key = k.getKeyStroke();
System.out.println("The key you pressed was: "+key+".\n");
...

When I compile the program I get.

--------------------Configuration: <Default>--------------------
C:\Documents and Settings\admin\Desktop\KeyLogger.java:19: cannot resolve symbol
symbol : constructor KeyStroke ()
location: class javax.swing.KeyStroke
KeyStroke k = new KeyStroke();
^
C:\Documents and Settings\admin\Desktop\KeyLogger.java:26: cannot resolve symbol
symbol : method getKeyStroke ()
location: class javax.swing.KeyStroke
key = k.getKeyStroke();

Any tips? Thanks.

Antoniohawk
10-07-2005, 06:00 PM
Even though your intentions may be genuine, there's no way of knowing. Gotta shut you down.