Anmeldungsdatum: Aug 2007
Beiträge: 8643
Benutzer-Bewertung:
|
Credits: Gordon
TEXT Code: #include <windows.h> #include <tlhelp32.h> #include <conio.h> #include <iostream> using namespace std; HANDLE hProcess = NULL; DWORD dwStartAddress = 0; DWORD dwCurrentAddress = 0; DWORD dwSize = 0; BYTE Read[200] = {0}; bool bFound[100] = {0}; bool strstri(const char* a, const char* b) { char szBuffer1[1024] = ""; char szBuffer2[1024] = ""; for(int i = 0; i < strlen(a); i++) szBuffer1[i] = tolower(a[i]); for(int i = 0; i < strlen(b); i++) szBuffer2[i] = tolower(b[i]); return strstr(szBuffer1, szBuffer2); } bool GetWarrock() { HANDLE hModule = NULL; PROCESSENTRY32 pe32 = {0}; pe32.dwSize = sizeof(PROCESSENTRY32); while(1) { hModule = CreateToolhelp32Snapshot(0x2, 0); if(!hModule || hModule == (HANDLE)-1) return 0; if(!Process32First(hModule, &pe32)) { CloseHandle(hModule); return 0; } do { if(strstri(pe32.szExeFile, "warrock")) { Sleep(1000); CloseHandle(hModule); hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pe32.th32ProcessID); MODULEENTRY32 me32 = {0}; me32.dwSize = sizeof(MODULEENTRY32); while(1) { hModule = CreateToolhelp32Snapshot(0x8, pe32.th32ProcessID); if(!hModule || hModule == (HANDLE)-1) return 0; if(!Module32First(hModule, &me32)) { CloseHandle(hModule); return 0; } do { if(strstri(me32.szModule, "warrock")) { dwStartAddress = (DWORD)me32.modBaseAddr; dwSize = me32.modBaseSize; CloseHandle(hModule); return 1; } Sleep(10); } while(Module32Next(hModule, &me32)); Sleep(10); } } Sleep(10); } while(Process32Next(hModule, &pe32)); Sleep(20); } return 0; } char mskPlayerPointer[] = "\xA1\xFF\xFF\xFF\xFF\x56\x50\xE8"; void AddSig(char* szSig, int iCorrection, bool isPtr, char* szName, int iIndex) { if(bFound[iIndex]) goto end; for(int i = 0; i < strlen(szSig); i++) { if((BYTE)szSig[i] == 0xFF) goto endfor; if((BYTE)szSig[i] != Read[i+100]) goto end; endfor:; } dwCurrentAddress += 100 + iCorrection; if(isPtr) { DWORD dwReadValue = 0; ReadProcessMemory(hProcess, (void*)dwCurrentAddress, &dwReadValue, 4, 0); printf("%s: %X\n", szName, dwReadValue); } else { printf("%s: %X\n", szName, dwCurrentAddress); } bFound[iIndex] = true; end:; } int main() { DWORD dwProcessId = GetWarrock(); printf("Startaddress: %X\nSize: %X\n", dwStartAddress, dwSize); if(!hProcess || hProcess == (HANDLE)-1) { printf("Error while opening process...\n"); goto end; } for(int i = 0; i < dwSize/6; i++) { if(ReadProcessMemory(hProcess, (void*)(dwStartAddress + i), &Read, 200, 0)) { dwCurrentAddress = dwStartAddress + i; AddSig(mskPlayerPointer, 1, true, "Playerpointer", 1); } else { printf("Reading failed - process terminated?\n"); goto end; } } end:; getch(); return 0; }
greetz KN4CK3R
|