Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <windows.h>
- #include "CMutate.h"
- __declspec(naked) void MutateCore( void )
- {
- _asm _emit 0x90; //0
- _asm _emit 0x90; //1
- _asm _emit 0x90; //2
- _asm _emit 0x90; //3
- _asm _emit 0x90; //4
- _asm _emit 0x90; //5
- _asm _emit 0x90; //6
- _asm _emit 0x90; //7
- _asm _emit 0x90; //8
- _asm _emit 0x90; //9
- _asm _emit 0x90; //10
- _asm _emit 0x90; //11
- _asm _emit 0x90; //12
- _asm _emit 0x90; //13
- _asm _emit 0x90; //14
- _asm _emit 0x90; //15
- _asm _emit 0x90; //16
- _asm _emit 0x90; //17
- _asm _emit 0x90; //18
- _asm _emit 0x90; //19
- _asm _emit 0x90; //20
- _asm _emit 0x90; //21
- _asm _emit 0x90; //22
- _asm _emit 0x90; //23
- _asm _emit 0x90; //24
- _asm _emit 0x90; //25
- _asm _emit 0x90; //26
- _asm _emit 0x90; //27
- _asm _emit 0x90; //28
- _asm _emit 0x90; //29
- _asm _emit 0x90; //30
- _asm _emit 0x90; //31
- _asm _emit 0x90; //32
- _asm retn;
- }
- DWORD WINAPI lpMutate( LPVOID lpParams )
- {
- int *iRandomSeed = (int *)lpParams;
- if( iRandomSeed == NULL )
- {
- iRandomSeed = new int;
- *iRandomSeed = rand()%9999;
- }
- else
- {
- if( *iRandomSeed == 0 )
- {
- iRandomSeed = new int;
- *iRandomSeed = rand()%9999;
- }
- }
- while( true )
- {
- MEMORY_BASIC_INFORMATION mbi;
- VirtualQuery( MutateCore, &mbi, sizeof( mbi ) );
- VirtualProtect( mbi.BaseAddress, mbi.RegionSize, PAGE_EXECUTE_READWRITE, &mbi.Protect );
- BYTE *byteArrayMutateCore = (BYTE *)MutateCore;
- for( int i = 0; i < 32; i++ )
- {
- srand( GetTickCount() * (i + i * i) * (*iRandomSeed));
- byteArrayMutateCore[i] = rand() % 255;
- }
- VirtualProtect( mbi.BaseAddress, mbi.RegionSize, mbi.Protect, NULL );
- FlushInstructionCache( GetCurrentProcess(), MutateCore, 32 );
- Sleep(10);
- }
- return 0;
- }
- void CMutate::SetRandomSeed( int iRandomSeed )
- {
- m_iRandomSeed = iRandomSeed;
- }
- void CMutate::InitiateMutation()
- {
- //this will ensure its referenced as a function
- MutateCore();
- CreateThread( 0, 0, lpMutate, &m_iRandomSeed, 0, 0 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement