Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetDlgItemTextW( STATUSLABEL, L"Waiting for warrock.exe..." );
- PROCESSENTRY32 peWarrockProcess;
- HANDLE hWarrockProcess;
- bool test = false;
- while(true)
- {
- hWarrockProcess = CreateToolhelp32Snapshot( TH32CS_SNAPALL, 0 );
- if( hWarrockProcess == INVALID_HANDLE_VALUE ){
- SetDlgItemTextW( STATUSLABEL, L"Error: Cannot create process snapshot." );
- return;
- }
- peWarrockProcess.dwSize = sizeof( PROCESSENTRY32 );
- BOOL bSucceed = Process32First( hWarrockProcess, &peWarrockProcess );
- SetDlgItemTextW( STATUSLABEL, L"Waiting for warrock.exe." );
- if( !bSucceed ){
- SetDlgItemTextW( STATUSLABEL, L"Error." );
- return;
- }
- while( bSucceed ){
- if( stristr(peWarrockProcess.szExeFile, "warrock" ) ){
- SetDlgItemTextW( STATUSLABEL, L"Found warrock.exe." );
- test = true;
- break;
- }
- bSucceed = Process32Next( hWarrockProcess, &peWarrockProcess );
- peWarrockProcess.dwSize = sizeof( PROCESSENTRY32 );
- }
- if(test)
- {
- break;
- }
- Sleep(500);
- }
- if(test)
- {
- if( !peWarrockProcess.th32ProcessID ){
- SetDlgItemTextW( STATUSLABEL, L"Error: Could not get the process ID of remote process." );
- }
- SetDlgItemTextW( STATUSLABEL, L"Injecting DLL." );
- HANDLE hWarrockProcessID = OpenProcess( PROCESS_ALL_ACCESS, false, peWarrockProcess.th32ProcessID );
- if( !hWarrockProcessID ){
- SetDlgItemTextW( STATUSLABEL, L"Error: Could not open remote process." );
- return;
- }
- LPVOID lpvLoadLibraryAddr = GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "LoadLibraryA" );
- LPVOID lpvResult = VirtualAllocEx( hWarrockProcessID, NULL, strlen( "Sourced_WR.dll" ), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE );
- if( !lpvResult ){
- SetDlgItemTextW( STATUSLABEL, L"Error: Cannot allocate memory in remote process" );
- CloseHandle( hWarrockProcessID );
- return;
- }
- BOOL bWPRes = WriteProcessMemory( hWarrockProcessID, lpvResult, "Sourced_WR.dll", strlen( "Sourced_WR.dll" ), NULL);
- if( !bWPRes ){
- SetDlgItemTextW( STATUSLABEL, L"Error: Cannot write to remote process." );
- CloseHandle( hWarrockProcessID );
- return;
- }
- if( !CreateRemoteThread( hWarrockProcessID, NULL, NULL, (LPTHREAD_START_ROUTINE)lpvLoadLibraryAddr, lpvResult, NULL, NULL) ){
- SetDlgItemTextW( STATUSLABEL, L"Error: Cannot create thread in remote process." );
- CloseHandle( hWarrockProcessID );
- return;
- }
- else{
- SetDlgItemTextW( STATUSLABEL, peWarrockProcess.szExeFile );
- if( bClose ){
- CloseHandle( hWarrockProcessID );
- ExitProcess( 0 );
- }
- }
- }
- else
- {
- SetDlgItemTextW( STATUSLABEL, L"Error: Could not find warrock.exe" );
- }
- CloseHandle( hWarrockProcessID );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement