Results 1 to 1 of 1
  1. #1
    absde20
    absde20 is offline
    New member
    Join Date
    2013 Apr
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Pattern Signature Scanner

    I've got a C++ Issue about Pattern,
    Code:
    Functions.h
    #include <iostream>
    #include <Windows.h>
    #include <tlhelp32.h>
    #include <Psapi.h>
    
    void MsgBoxAddy(DWORD addy)
    {
    	char szBuffer[1024];
    	sprintf(szBuffer, "Addy: %02x", addy);
    	MessageBox(NULL, szBuffer, "Title", MB_OK);
    
    }
    
    MODULEINFO GetModuleInfo( char *szModule )
    {
    	MODULEINFO modinfo = {0};
    	HMODULE hModule = GetModuleHandle(szModule);
    	if(hModule == 0) 
    		return modinfo;
    	GetModuleInformation(GetCurrentProcess(), hModule, &modinfo, sizeof(MODULEINFO));
    	return modinfo;
    }
    
    
    void WriteToMemory(uintptr_t addressToWrite, char* valueToWrite, int byteNum)
    {
    	unsigned long OldProtection;
    	VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
    	memcpy( (LPVOID)addressToWrite, valueToWrite, byteNum);
    	VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL);
    }
    
    
    DWORD FindPattern(char *module, char *pattern, char *mask)
    {
    	MODULEINFO mInfo = GetModuleInfo(module);
    	DWORD base = (DWORD)mInfo.lpBaseOfDll;
    	DWORD size =  (DWORD)mInfo.SizeOfImage;
    	DWORD patternLength = (DWORD)strlen(mask);
    
    	for(DWORD i = 0; i < size - patternLength; i++)
    	{
    		bool found = true;
    		for(DWORD j = 0; j < patternLength; j++)
    		{
    			found &= mask[j] == '?' || pattern[j] == *(char*)(base + i + j);
    		}
    		if(found) 
    		{
    			return base + i;
    		}
    	}
    
    	return NULL;
    } 
    
    Source.cpp
    #include <Windows.h>
    #include <iostream>  
    #include "Functions.h"
    
    using namespace std;
    char OpCode[] = "\xDB\x45";
    
    
    void InitiateHooks()
    {
    		DWORD aAddy = FindPattern("s4client.exe",
    		"\xD9\x45\x57\x8B\x7C\x24\x14\x8D\x74\x24\x28\xE8\x00\x00\x00\x00\x5F\x5E\xB0\x01",
    		"xxxxxxxxxxxx????xxxx");
    	aAddy += 5;
    
    
    	MsgBoxAddy(aAddy);
    	WriteToMemory(aAddy, OpCode, 4);
    	
    }
    #pragma endregion
    
    BOOL WINAPI DllMain(
        HINSTANCE hinstDLL, 
        DWORD fdwReason, 
        LPVOID lpReserved) 
    {
        switch(fdwReason)
        {
            case DLL_PROCESS_ATTACH:
    			InitiateHooks();
                break;
        }
        return TRUE;
    }
    why won't work when OLLYDBG not work

Similar Threads

  1. [Tutorial] Free Signature in pgc !
    By bubian2 in forum Programming Tutorials
    Replies: 0
    Last Post: 2013-07-28, 07:10 PM
  2. Pattern Helper
    By hanswurst in forum Files & Tools
    Replies: 0
    Last Post: 2013-06-18, 10:05 PM
  3. Photoshop Tutorial: Create Smudge Signature
    By abalamadilo in forum Graphics Tutorials
    Replies: 2
    Last Post: 2012-03-12, 09:34 PM
  4. [C++] Signature scanner
    By Dwar in forum C/C++
    Replies: 3
    Last Post: 2011-06-29, 11:45 PM
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •